Commit 7716f383 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull cgroup updates from Tejun Heo:

 - Per-cpu cpu usage stats are now tracked

   This currently isn't printed out in the cgroupfs interface and can
   only be accessed through e.g. BPF. Should decide on a not-too-ugly
   way to show per-cpu stats in cgroupfs

 - cpuset received some cleanups and prepatory patches for the pending
   cpus.exclusive patchset which will allow cpuset partitions to be
   created below non-partition parents, which should ease the management
   of partition cpusets

 - A lot of code and documentation cleanup patches

 - tools/testing/selftests/cgroup/test_cpuset.c added

* tag 'cgroup-for-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (32 commits)
  cgroup: Avoid -Wstringop-overflow warnings
  cgroup:namespace: Remove unused cgroup_namespaces_init()
  cgroup/rstat: Record the cumulative per-cpu time of cgroup and its descendants
  cgroup: clean up if condition in cgroup_pidlist_start()
  cgroup: fix obsolete function name in cgroup_destroy_locked()
  Documentation: cgroup-v2.rst: Correct number of stats entries
  cgroup: fix obsolete function name above css_free_rwork_fn()
  cgroup/cpuset: fix kernel-doc
  cgroup: clean up printk()
  cgroup: fix obsolete comment above cgroup_create()
  docs: cgroup-v1: fix typo
  docs: cgroup-v1: correct the term of Page Cache organization in inode
  cgroup/misc: Store atomic64_t reads to u64
  cgroup/misc: Change counters to be explicit 64bit types
  cgroup/misc: update struct members descriptions
  cgroup: remove cgrp->kn check in css_populate_dir()
  cgroup: fix obsolete function name
  cgroup: use cached local variable parent in for loop
  cgroup: remove obsolete comment above struct cgroupstats
  cgroup: put cgroup_tryget_css() inside CONFIG_CGROUP_SCHED
  ...
parents e987af45 78d44b82
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -195,11 +195,11 @@ are not accounted. We just account pages under usual VM management.

RSS pages are accounted at page_fault unless they've already been accounted
for earlier. A file page will be accounted for as Page Cache when it's
inserted into inode (radix-tree). While it's mapped into the page tables of
inserted into inode (xarray). While it's mapped into the page tables of
processes, duplicate accounting is carefully avoided.

An RSS page is unaccounted when it's fully unmapped. A PageCache page is
unaccounted when it's removed from radix-tree. Even if RSS pages are fully
unaccounted when it's removed from xarray. Even if RSS pages are fully
unmapped (by kswapd), they may exist as SwapCache in the system until they
are really freed. Such SwapCaches are also accounted.
A swapped-in page is accounted after adding into swapcache.
@@ -907,7 +907,7 @@ experiences some pressure. In this situation, only group C will receive the
notification, i.e. groups A and B will not receive it. This is done to avoid
excessive "broadcasting" of messages, which disturbs the system and which is
especially bad if we are low on memory or thrashing. Group B, will receive
notification only if there are no event listers for group C.
notification only if there are no event listeners for group C.

There are three optional modes that specify different propagation behavior:

+1 −1
Original line number Diff line number Diff line
@@ -1045,7 +1045,7 @@ All time durations are in microseconds.
	- user_usec
	- system_usec

	and the following three when the controller is enabled:
	and the following five when the controller is enabled:

	- nr_periods
	- nr_throttled
+2 −0
Original line number Diff line number Diff line
@@ -5255,6 +5255,8 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git
F:	Documentation/admin-guide/cgroup-v1/cpusets.rst
F:	include/linux/cpuset.h
F:	kernel/cgroup/cpuset.c
F:	tools/testing/selftests/cgroup/test_cpuset.c
F:	tools/testing/selftests/cgroup/test_cpuset_prs.sh
CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)
M:	Johannes Weiner <hannes@cmpxchg.org>
+14 −0
Original line number Diff line number Diff line
@@ -341,6 +341,20 @@ struct cgroup_rstat_cpu {
	 */
	struct cgroup_base_stat last_bstat;

	/*
	 * This field is used to record the cumulative per-cpu time of
	 * the cgroup and its descendants. Currently it can be read via
	 * eBPF/drgn etc, and we are still trying to determine how to
	 * expose it in the cgroupfs interface.
	 */
	struct cgroup_base_stat subtree_bstat;

	/*
	 * Snapshots at the last reading. These are used to calculate the
	 * deltas to propagate to the per-cpu subtree_bstat.
	 */
	struct cgroup_base_stat last_subtree_bstat;

	/*
	 * Child cgroups with stat updates on this cpu since the last read
	 * are linked on the parent's ->updated_children through
+13 −15
Original line number Diff line number Diff line
@@ -31,17 +31,18 @@ struct misc_cg;
 * struct misc_res: Per cgroup per misc type resource
 * @max: Maximum limit on the resource.
 * @usage: Current usage of the resource.
 * @failed: True if charged failed for the resource in a cgroup.
 * @events: Number of times, the resource limit exceeded.
 */
struct misc_res {
	unsigned long max;
	atomic_long_t usage;
	atomic_long_t events;
	u64 max;
	atomic64_t usage;
	atomic64_t events;
};

/**
 * struct misc_cg - Miscellaneous controller's cgroup structure.
 * @css: cgroup subsys state object.
 * @events_file: Handle for the misc resources events file.
 * @res: Array of misc resources usage in the cgroup.
 */
struct misc_cg {
@@ -53,12 +54,10 @@ struct misc_cg {
	struct misc_res res[MISC_CG_RES_TYPES];
};

unsigned long misc_cg_res_total_usage(enum misc_res_type type);
int misc_cg_set_capacity(enum misc_res_type type, unsigned long capacity);
int misc_cg_try_charge(enum misc_res_type type, struct misc_cg *cg,
		       unsigned long amount);
void misc_cg_uncharge(enum misc_res_type type, struct misc_cg *cg,
		      unsigned long amount);
u64 misc_cg_res_total_usage(enum misc_res_type type);
int misc_cg_set_capacity(enum misc_res_type type, u64 capacity);
int misc_cg_try_charge(enum misc_res_type type, struct misc_cg *cg, u64 amount);
void misc_cg_uncharge(enum misc_res_type type, struct misc_cg *cg, u64 amount);

/**
 * css_misc() - Get misc cgroup from the css.
@@ -99,27 +98,26 @@ static inline void put_misc_cg(struct misc_cg *cg)

#else /* !CONFIG_CGROUP_MISC */

static inline unsigned long misc_cg_res_total_usage(enum misc_res_type type)
static inline u64 misc_cg_res_total_usage(enum misc_res_type type)
{
	return 0;
}

static inline int misc_cg_set_capacity(enum misc_res_type type,
				       unsigned long capacity)
static inline int misc_cg_set_capacity(enum misc_res_type type, u64 capacity)
{
	return 0;
}

static inline int misc_cg_try_charge(enum misc_res_type type,
				     struct misc_cg *cg,
				     unsigned long amount)
				     u64 amount)
{
	return 0;
}

static inline void misc_cg_uncharge(enum misc_res_type type,
				    struct misc_cg *cg,
				    unsigned long amount)
				    u64 amount)
{
}

Loading