// Cpu void TCpuSubsystem::InitializeSubsystem() { TCgroup cg = RootCgroup(); HasShares = cg.Has("cpu.shares"); if (HasShares && cg.GetUint64("cpu.shares", BaseShares)) BaseShares = 1024; HasQuota = cg.Has("cpu.cfs_quota_us") && cg.Has("cpu.cfs_period_us"); HasReserve = HasShares && HasQuota && cg.Has("cpu.cfs_reserve_us") && cg.Has("cpu.cfs_reserve_shares"); if (HasQuota && cg.GetUint64("cpu.cfs_period_us", BasePeriod)) BasePeriod = 100000; HasSmart = cg.Has("cpu.smart"); L_SYS() << GetNumCores() << " cores" << std::endl; if (HasShares) L_SYS() << "base shares " << BaseShares << std::endl; if (HasQuota) L_SYS() << "quota period " << BasePeriod << std::endl; if (HasReserve) L_SYS() << "support reserves" << std::endl; if (HasSmart) L_SYS() << "support smart" << std::endl; }
TError TBlkioSubsystem::SetPolicy(TCgroup &cg, bool batch) { if (!SupportPolicy()) return TError::Success(); std::string rootWeight; if (!batch) { TError error = RootCgroup().Get("blkio.weight", rootWeight); if (error) return TError(EError::Unknown, "Can't get root blkio.weight"); } return cg.Set("blkio.weight", batch ? std::to_string(config().container().batch_io_weight()) : rootWeight); }
bool SupportRechargeOnPgfault() const { return RootCgroup().Has(RECHARGE_ON_PAGE_FAULT); }
bool SupportSwap() const { return RootCgroup().Has(MEM_SWAP_LIMIT); }
bool SupportDirtyLimit() const { return RootCgroup().Has(DIRTY_LIMIT); }
bool SupportIoLimit() const { return RootCgroup().Has(FS_BPS_LIMIT); }
bool SupportGuarantee() const { return RootCgroup().Has(LOW_LIMIT); }
bool SupportGigaPages() const { return RootCgroup().Has(GIGA_LIMIT); }
/* for now supports only 2MB pages */ void InitializeSubsystem() override { Supported = RootCgroup().Has(HUGE_LIMIT); }
void InitializeSubsystem() override { HasWeight = RootCgroup().Has("blkio.weight"); HasThrottler = RootCgroup().Has("blkio.throttle.read_bps_device"); if (RootCgroup().GetBool("cgroup.sane_behavior", HasSaneBehavior)) HasSaneBehavior = false; }
bool TBlkioSubsystem::SupportPolicy() { return RootCgroup().Has("blkio.weight"); }