Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1253403 > unrolled thread

[PATCH cgroup/for-4.4 1/3] cgroup: replace __DEVEL__sane_behavior with cgroup2 fs type

Started byTejun Heo <tj@kernel.org>
First post2015-10-22 03:30 +0200
Last post2015-10-26 04:00 +0100
Articles 8 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH cgroup/for-4.4 1/3] cgroup: replace __DEVEL__sane_behavior  with cgroup2 fs type Tejun Heo <tj@kernel.org> - 2015-10-22 03:30 +0200
    Re: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt  with a proper cgroup v2 documentation Tejun Heo <tj@kernel.org> - 2015-10-22 16:40 +0200
      Re: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt  with a proper cgroup v2 documentation Vivek Goyal <vgoyal@redhat.com> - 2015-10-22 16:50 +0200
        Re: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt  with a proper cgroup v2 documentation Tejun Heo <tj@kernel.org> - 2015-10-22 17:30 +0200
      Re: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt  with a proper cgroup v2 documentation Tejun Heo <tj@kernel.org> - 2015-10-23 03:20 +0200
        Re: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt  with a proper cgroup v2 documentation Vivek Goyal <vgoyal@redhat.com> - 2015-10-23 14:20 +0200
    Re: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt  with a proper cgroup v2 documentation Vivek Goyal <vgoyal@redhat.com> - 2015-10-22 16:40 +0200
    Re: [PATCH v2 cgroup/for-4.4 3/3] cgroup: replace  unified-hierarchy.txt with a proper cgroup v2 documentation Zefan Li <lizefan@huawei.com> - 2015-10-26 04:00 +0100

#1253403 — [PATCH cgroup/for-4.4 1/3] cgroup: replace __DEVEL__sane_behavior with cgroup2 fs type

FromTejun Heo <tj@kernel.org>
Date2015-10-22 03:30 +0200
Subject[PATCH cgroup/for-4.4 1/3] cgroup: replace __DEVEL__sane_behavior with cgroup2 fs type
Message-ID<qmcRA-3LF-23@gated-at.bofh.it>
From b1e2fadd2baa70225c14de9fee09063793091c31 Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@kernel.org>
Date: Thu, 22 Oct 2015 09:48:38 +0900

With major controllers - cpu, memory and io - shaping up for the
unified hierarchy, cgroup2 is about ready to be, gradually, released
into the wild.  Replace __DEVEL__sane_behavior flag which was used to
select the unified hierarchy with a separate filesystem type "cgroup2"
so that unified hierarchy can be mounted as follows.

  mount -t cgroup2 none $MOUNT_POINT

The cgroup2 fs has its own magic number - 0x63677270 ("cgrp").

v2: Assign a different magic number to cgroup2 fs.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
---
Hello,

This patchset removes devel mask from cgroup v2 and adds full
documentation.

While cpu side isn't settled yet, memory and io will be ready for the
4.4 merge window.  I'll keep trying to reach a consensus on cpu for
the 4.4 merge window but given that memory + io on cgroup v2 enables
cgroup writeback which is a major missing feature on v1, I think it
makes sense to push out v2 interface for memory and io for the 4.4
window especially as v1 and v2 can be used together.  Please note that
the discussion around cpu, no matter how it concludes, doesn't affect
anything for cgroup core, memory or io at all.

This patchset is on top of

  cgroup/for-4.4 e4b7037c8613da41fb3f7b029414fe25370f5
+ [1] [PATCH] blkcg: don't create "io.stat" on the root

and available in the following git branch.

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git review-cgroup2

Thanks.

[1] http://lkml.kernel.org/g/20151022003103.GB10199@mtj.duckdns.org

 Documentation/cgroups/unified-hierarchy.txt |  6 ++--
 include/linux/cgroup-defs.h                 |  1 -
 include/uapi/linux/magic.h                  |  1 +
 kernel/cgroup.c                             | 47 ++++++++++++++---------------
 4 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/Documentation/cgroups/unified-hierarchy.txt b/Documentation/cgroups/unified-hierarchy.txt
index 0cd27a4..1161ba4 100644
--- a/Documentation/cgroups/unified-hierarchy.txt
+++ b/Documentation/cgroups/unified-hierarchy.txt
@@ -94,11 +94,9 @@ the process.
 
 2-1. Mounting
 
-Currently, unified hierarchy can be mounted with the following mount
-command.  Note that this is still under development and scheduled to
-change soon.
+Unified hierarchy can be mounted with the following mount command.
 
- mount -t cgroup -o __DEVEL__sane_behavior cgroup $MOUNT_POINT
+ mount -t cgroup2 none $MOUNT_POINT
 
 All controllers which support the unified hierarchy and are not bound
 to other hierarchies are automatically bound to unified hierarchy and
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index 60d44b2..f43dee6 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -66,7 +66,6 @@ enum {
 
 /* cgroup_root->flags */
 enum {
-	CGRP_ROOT_SANE_BEHAVIOR	= (1 << 0), /* __DEVEL__sane_behavior specified */
 	CGRP_ROOT_NOPREFIX	= (1 << 1), /* mounted subsystems have no named prefix */
 	CGRP_ROOT_XATTR		= (1 << 2), /* supports extended attributes */
 };
diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
index 7b1425a..1dd008c 100644
--- a/include/uapi/linux/magic.h
+++ b/include/uapi/linux/magic.h
@@ -54,6 +54,7 @@
 
 #define SMB_SUPER_MAGIC		0x517B
 #define CGROUP_SUPER_MAGIC	0x27e0eb
+#define CGROUP2_SUPER_MAGIC	0x63677270
 
 
 #define STACK_END_MAGIC		0x57AC6E9D
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 4f4fc53..2528105 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -205,6 +205,7 @@ static unsigned long have_free_callback __read_mostly;
 /* Ditto for the can_fork callback. */
 static unsigned long have_canfork_callback __read_mostly;
 
+static struct file_system_type cgroup2_fs_type;
 static struct cftype cgroup_dfl_base_files[];
 static struct cftype cgroup_legacy_base_files[];
 
@@ -1625,10 +1626,6 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
 			all_ss = true;
 			continue;
 		}
-		if (!strcmp(token, "__DEVEL__sane_behavior")) {
-			opts->flags |= CGRP_ROOT_SANE_BEHAVIOR;
-			continue;
-		}
 		if (!strcmp(token, "noprefix")) {
 			opts->flags |= CGRP_ROOT_NOPREFIX;
 			continue;
@@ -1695,15 +1692,6 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
 			return -ENOENT;
 	}
 
-	if (opts->flags & CGRP_ROOT_SANE_BEHAVIOR) {
-		pr_warn("sane_behavior: this is still under development and its behaviors will change, proceed at your own risk\n");
-		if (nr_opts != 1) {
-			pr_err("sane_behavior: no other mount options allowed\n");
-			return -EINVAL;
-		}
-		return 0;
-	}
-
 	/*
 	 * If the 'all' option was specified select all the subsystems,
 	 * otherwise if 'none', 'name=' and a subsystem name options were
@@ -1983,6 +1971,7 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
 			 int flags, const char *unused_dev_name,
 			 void *data)
 {
+	bool is_v2 = fs_type == &cgroup2_fs_type;
 	struct super_block *pinned_sb = NULL;
 	struct cgroup_subsys *ss;
 	struct cgroup_root *root;
@@ -1999,6 +1988,17 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
 	if (!use_task_css_set_links)
 		cgroup_enable_task_cg_lists();
 
+	if (is_v2) {
+		if (data) {
+			pr_err("cgroup2: unknown option \"%s\"\n", (char *)data);
+			return ERR_PTR(-EINVAL);
+		}
+		cgrp_dfl_root_visible = true;
+		root = &cgrp_dfl_root;
+		cgroup_get(&root->cgrp);
+		goto out_mount;
+	}
+
 	mutex_lock(&cgroup_mutex);
 
 	/* First find the desired set of subsystems */
@@ -2006,15 +2006,6 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
 	if (ret)
 		goto out_unlock;
 
-	/* look for a matching existing root */
-	if (opts.flags & CGRP_ROOT_SANE_BEHAVIOR) {
-		cgrp_dfl_root_visible = true;
-		root = &cgrp_dfl_root;
-		cgroup_get(&root->cgrp);
-		ret = 0;
-		goto out_unlock;
-	}
-
 	/*
 	 * Destruction of cgroup root is asynchronous, so subsystems may
 	 * still be dying after the previous unmount.  Let's drain the
@@ -2125,9 +2116,10 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
 
 	if (ret)
 		return ERR_PTR(ret);
-
+out_mount:
 	dentry = kernfs_mount(fs_type, flags, root->kf_root,
-				CGROUP_SUPER_MAGIC, &new_sb);
+			      is_v2 ? CGROUP2_SUPER_MAGIC : CGROUP_SUPER_MAGIC,
+			      &new_sb);
 	if (IS_ERR(dentry) || !new_sb)
 		cgroup_put(&root->cgrp);
 
@@ -2170,6 +2162,12 @@ static struct file_system_type cgroup_fs_type = {
 	.kill_sb = cgroup_kill_sb,
 };
 
+static struct file_system_type cgroup2_fs_type = {
+	.name = "cgroup2",
+	.mount = cgroup_mount,
+	.kill_sb = cgroup_kill_sb,
+};
+
 /**
  * task_cgroup_path - cgroup path of a task in the first cgroup hierarchy
  * @task: target task
@@ -5288,6 +5286,7 @@ int __init cgroup_init(void)
 
 	WARN_ON(sysfs_create_mount_point(fs_kobj, "cgroup"));
 	WARN_ON(register_filesystem(&cgroup_fs_type));
+	WARN_ON(register_filesystem(&cgroup2_fs_type));
 	WARN_ON(!proc_create("cgroups", 0, NULL, &proc_cgroupstats_operations));
 
 	return 0;
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1253883 — Re: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation

FromTejun Heo <tj@kernel.org>
Date2015-10-22 16:40 +0200
SubjectRe: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation
Message-ID<qmpc6-5kr-29@gated-at.bofh.it>
In reply to#1253403
On Thu, Oct 22, 2015 at 10:34:27AM -0400, Vivek Goyal wrote:
> On Thu, Oct 22, 2015 at 10:23:54AM +0900, Tejun Heo wrote:
> 
> [..]
> > +5-3-2. Writeback
> > +
> > +Writeback of page cache manages the dirty memory ratio and is an
> > +integral part of memory management.  The io controller, in conjunction
> > +with the memory controller, implements control of page cache writeback
> > +IOs.  The memory controller defines the memory domain that dirty
> > +memory ratio is calculated and maintained for and the io controller
> > +defines the io domain which writes out dirty pages for the memory
> > +domain.
> 
> Hi Tejun,
> 
> Glad that finally devel flag will go away and new shiny unified hierarchy
> can be used using cgroup2 fstype. Thanks for all this hard work.
> 
> Will it make sense to also talk about what filesystems currently writeback
> cgroup work with. IIUC, currently this works with ext2 and there are plans to
> make it work with other filesystems.

It works with ext2 and 4 and btrfs.  Will document it.  Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1253891 — Re: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation

FromVivek Goyal <vgoyal@redhat.com>
Date2015-10-22 16:50 +0200
SubjectRe: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation
Message-ID<qmplN-5wh-25@gated-at.bofh.it>
In reply to#1253883
On Thu, Oct 22, 2015 at 11:36:05PM +0900, Tejun Heo wrote:
> On Thu, Oct 22, 2015 at 10:34:27AM -0400, Vivek Goyal wrote:
> > On Thu, Oct 22, 2015 at 10:23:54AM +0900, Tejun Heo wrote:
> > 
> > [..]
> > > +5-3-2. Writeback
> > > +
> > > +Writeback of page cache manages the dirty memory ratio and is an
> > > +integral part of memory management.  The io controller, in conjunction
> > > +with the memory controller, implements control of page cache writeback
> > > +IOs.  The memory controller defines the memory domain that dirty
> > > +memory ratio is calculated and maintained for and the io controller
> > > +defines the io domain which writes out dirty pages for the memory
> > > +domain.
> > 
> > Hi Tejun,
> > 
> > Glad that finally devel flag will go away and new shiny unified hierarchy
> > can be used using cgroup2 fstype. Thanks for all this hard work.
> > 
> > Will it make sense to also talk about what filesystems currently writeback
> > cgroup work with. IIUC, currently this works with ext2 and there are plans to
> > make it work with other filesystems.
> 
> It works with ext2 and 4 and btrfs.  Will document it.  Thanks.

Oh, nice. Are there any plans to make it work with xfs too?

Thanks
Vivek
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1253909 — Re: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation

FromTejun Heo <tj@kernel.org>
Date2015-10-22 17:30 +0200
SubjectRe: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation
Message-ID<qmpYu-6uH-13@gated-at.bofh.it>
In reply to#1253891
Hello,

On Thu, Oct 22, 2015 at 10:42:21AM -0400, Vivek Goyal wrote:
> > It works with ext2 and 4 and btrfs.  Will document it.  Thanks.
> 
> Oh, nice. Are there any plans to make it work with xfs too?

Hmmm... not right now but it shouldn't be *too* difficult to add.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1254268 — Re: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation

FromTejun Heo <tj@kernel.org>
Date2015-10-23 03:20 +0200
SubjectRe: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation
Message-ID<qmzbr-31e-1@gated-at.bofh.it>
In reply to#1253883
Hello,

On Thu, Oct 22, 2015 at 11:36:05PM +0900, Tejun Heo wrote:
> It works with ext2 and 4 and btrfs.  Will document it.  Thanks.

Updated to include all writeback information from
blkio-controller.txt.

5-3-2. Writeback

Page cache is dirtied through buffered writes and shared mmaps and
written asynchronously to the backing filesystem by the writeback
mechanism.  Writeback sits between the memory and IO domains and
regulates the proportion of dirty memory by balancing dirtying and
write IOs.

The io controller, in conjunction with the memory controller,
implements control of page cache writeback IOs.  The memory controller
defines the memory domain that dirty memory ratio is calculated and
maintained for and the io controller defines the io domain which
writes out dirty pages for the memory domain.  Both system-wide and
per-cgroup dirty memory states are examined and the more restrictive
of the two is enforced.

cgroup writeback requires explicit support from the underlying
filesystem.  Currently, cgroup writeback is implemented on ext2, ext4
and btrfs.  On other filesystems, all writeback IOs are attributed to
the root cgroup.

There are inherent differences in memory and writeback management
which affects how cgroup ownership is tracked.  Memory is tracked per
page while writeback per inode.  For the purpose of writeback, an
inode is assigned to a cgroup and all IO requests to write dirty pages
from the inode are attributed to that cgroup.

As cgroup ownership for memory is tracked per page, there can be pages
which are associated with different cgroups than the one the inode is
associated with.  These are called foreign pages.  The writeback
constantly keeps track of foreign pages and, if a particular foreign
cgroup becomes the majority over a certain period of time, switches
the ownership of the inode to that cgroup.

While this model is enough for most use cases where a given inode is
mostly dirtied by a single cgroup even when the main writing cgroup
changes over time, use cases where multiple cgroups write to a single
inode simultaneously are not supported well.  In such circumstances, a
significant portion of IOs are likely to be attributed incorrectly.
As memory controller assigns page ownership on the first use and
doesn't update it until the page is released, even if writeback
strictly follows page ownership, multiple cgroups dirtying overlapping
areas wouldn't work as expected.  It's recommended to avoid such usage
patterns.

The sysctl knobs which affect writeback behavior are applied to cgroup
writeback as follows.

  vm.dirty_background_ratio
  vm.dirty_ratio

	These ratios apply the same to cgroup writeback with the
	amount of available memory capped by limits imposed by the
	memory controller and system-wide clean memory.

  vm.dirty_background_bytes
  vm.dirty_bytes

	For cgroup writeback, this is calculated into ratio against
	total available memory and applied the same way as
	vm.dirty[_background]_ratio.


P. Information on Kernel Programming

This section contains kernel programming information in the areas
where interacting with cgroup is necessary.  cgroup core and
controllers are not covered.


P-1. Filesystem Support for Writeback

A filesystem can support cgroup writeback by updating
address_space_operations->writepage[s]() to annotate bio's using the
following two functions.

  wbc_init_bio(@wbc, @bio)

	Should be called for each bio carrying writeback data and
	associates the bio with the inode's owner cgroup.  Can be
	called anytime between bio allocation and submission.

  wbc_account_io(@wbc, @page, @bytes)

	Should be called for each data segment being written out.
	While this function doesn't care exactly when it's called
	during the writeback session, it's the easiest and most
	natural to call it as data segments are added to a bio.

With writeback bio's annotated, cgroup support can be enabled per
super_block by setting SB_I_CGROUPWB in ->s_iflags.  This allows for
selective disabling of cgroup writeback support which is helpful when
certain filesystem features, e.g. journaled data mode, are
incompatible.

wbc_init_bio() binds the specified bio to its cgroup.  Depending on
the configuration, the bio may be executed at a lower priority and if
the writeback session is holding shared resources, e.g. a journal
entry, may lead to priority inversion.  There is no one easy solution
for the problem.  Filesystems can try to work around specific problem
cases by skipping wbc_init_bio() or using bio_associate_blkcg()
directly.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1254528 — Re: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation

FromVivek Goyal <vgoyal@redhat.com>
Date2015-10-23 14:20 +0200
SubjectRe: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation
Message-ID<qmJua-18q-9@gated-at.bofh.it>
In reply to#1254268
On Fri, Oct 23, 2015 at 10:18:07AM +0900, Tejun Heo wrote:
> Hello,
> 
> On Thu, Oct 22, 2015 at 11:36:05PM +0900, Tejun Heo wrote:
> > It works with ext2 and 4 and btrfs.  Will document it.  Thanks.
> 
> Updated to include all writeback information from
> blkio-controller.txt.
> 

Thanks Tejun. Looks good.

Vivek

> 5-3-2. Writeback
> 
> Page cache is dirtied through buffered writes and shared mmaps and
> written asynchronously to the backing filesystem by the writeback
> mechanism.  Writeback sits between the memory and IO domains and
> regulates the proportion of dirty memory by balancing dirtying and
> write IOs.
> 
> The io controller, in conjunction with the memory controller,
> implements control of page cache writeback IOs.  The memory controller
> defines the memory domain that dirty memory ratio is calculated and
> maintained for and the io controller defines the io domain which
> writes out dirty pages for the memory domain.  Both system-wide and
> per-cgroup dirty memory states are examined and the more restrictive
> of the two is enforced.
> 
> cgroup writeback requires explicit support from the underlying
> filesystem.  Currently, cgroup writeback is implemented on ext2, ext4
> and btrfs.  On other filesystems, all writeback IOs are attributed to
> the root cgroup.
> 
> There are inherent differences in memory and writeback management
> which affects how cgroup ownership is tracked.  Memory is tracked per
> page while writeback per inode.  For the purpose of writeback, an
> inode is assigned to a cgroup and all IO requests to write dirty pages
> from the inode are attributed to that cgroup.
> 
> As cgroup ownership for memory is tracked per page, there can be pages
> which are associated with different cgroups than the one the inode is
> associated with.  These are called foreign pages.  The writeback
> constantly keeps track of foreign pages and, if a particular foreign
> cgroup becomes the majority over a certain period of time, switches
> the ownership of the inode to that cgroup.
> 
> While this model is enough for most use cases where a given inode is
> mostly dirtied by a single cgroup even when the main writing cgroup
> changes over time, use cases where multiple cgroups write to a single
> inode simultaneously are not supported well.  In such circumstances, a
> significant portion of IOs are likely to be attributed incorrectly.
> As memory controller assigns page ownership on the first use and
> doesn't update it until the page is released, even if writeback
> strictly follows page ownership, multiple cgroups dirtying overlapping
> areas wouldn't work as expected.  It's recommended to avoid such usage
> patterns.
> 
> The sysctl knobs which affect writeback behavior are applied to cgroup
> writeback as follows.
> 
>   vm.dirty_background_ratio
>   vm.dirty_ratio
> 
> 	These ratios apply the same to cgroup writeback with the
> 	amount of available memory capped by limits imposed by the
> 	memory controller and system-wide clean memory.
> 
>   vm.dirty_background_bytes
>   vm.dirty_bytes
> 
> 	For cgroup writeback, this is calculated into ratio against
> 	total available memory and applied the same way as
> 	vm.dirty[_background]_ratio.
> 
> 
> P. Information on Kernel Programming
> 
> This section contains kernel programming information in the areas
> where interacting with cgroup is necessary.  cgroup core and
> controllers are not covered.
> 
> 
> P-1. Filesystem Support for Writeback
> 
> A filesystem can support cgroup writeback by updating
> address_space_operations->writepage[s]() to annotate bio's using the
> following two functions.
> 
>   wbc_init_bio(@wbc, @bio)
> 
> 	Should be called for each bio carrying writeback data and
> 	associates the bio with the inode's owner cgroup.  Can be
> 	called anytime between bio allocation and submission.
> 
>   wbc_account_io(@wbc, @page, @bytes)
> 
> 	Should be called for each data segment being written out.
> 	While this function doesn't care exactly when it's called
> 	during the writeback session, it's the easiest and most
> 	natural to call it as data segments are added to a bio.
> 
> With writeback bio's annotated, cgroup support can be enabled per
> super_block by setting SB_I_CGROUPWB in ->s_iflags.  This allows for
> selective disabling of cgroup writeback support which is helpful when
> certain filesystem features, e.g. journaled data mode, are
> incompatible.
> 
> wbc_init_bio() binds the specified bio to its cgroup.  Depending on
> the configuration, the bio may be executed at a lower priority and if
> the writeback session is holding shared resources, e.g. a journal
> entry, may lead to priority inversion.  There is no one easy solution
> for the problem.  Filesystems can try to work around specific problem
> cases by skipping wbc_init_bio() or using bio_associate_blkcg()
> directly.
> 
> -- 
> tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1253884 — Re: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation

FromVivek Goyal <vgoyal@redhat.com>
Date2015-10-22 16:40 +0200
SubjectRe: [PATCH cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation
Message-ID<qmpc6-5kr-31@gated-at.bofh.it>
In reply to#1253403
On Thu, Oct 22, 2015 at 10:23:54AM +0900, Tejun Heo wrote:

[..]
> +5-3-2. Writeback
> +
> +Writeback of page cache manages the dirty memory ratio and is an
> +integral part of memory management.  The io controller, in conjunction
> +with the memory controller, implements control of page cache writeback
> +IOs.  The memory controller defines the memory domain that dirty
> +memory ratio is calculated and maintained for and the io controller
> +defines the io domain which writes out dirty pages for the memory
> +domain.

Hi Tejun,

Glad that finally devel flag will go away and new shiny unified hierarchy
can be used using cgroup2 fstype. Thanks for all this hard work.

Will it make sense to also talk about what filesystems currently writeback
cgroup work with. IIUC, currently this works with ext2 and there are plans to
make it work with other filesystems.

Thanks
Vivek
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1255628 — Re: [PATCH v2 cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation

FromZefan Li <lizefan@huawei.com>
Date2015-10-26 04:00 +0100
SubjectRe: [PATCH v2 cgroup/for-4.4 3/3] cgroup: replace unified-hierarchy.txt with a proper cgroup v2 documentation
Message-ID<qnGaR-2zU-1@gated-at.bofh.it>
In reply to#1253403
On 2015/10/23 9:19, Tejun Heo wrote:
>>From 10d158783de74ad28454ff54556abf89bd85c756 Mon Sep 17 00:00:00 2001
> From: Tejun Heo <tj@kernel.org>
> Date: Fri, 23 Oct 2015 10:13:35 +0900
>
> Now that cgroup v2 is almost out of the door, replace the development
> documentation unified-hierarchy.txt with Documentation/cgroup.txt
> which is a superset of unified-hierarchy.txt and authoritatively
> describes all userland-visible aspects of cgroup.
>
> v2: Updated to include all information from blkio-controller.txt and
>      list filesystems which support cgroup writeback as suggested by
>      Vivek.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Vivek Goyal <vgoyal@redhat.com>
> ---
>   Documentation/cgroup-legacy/blkio-controller.txt  |   79 --
>   Documentation/cgroup-legacy/unified-hierarchy.txt |  645 ----------
>   Documentation/cgroup.txt                          | 1293 +++++++++++++++++++++
>   3 files changed, 1293 insertions(+), 724 deletions(-)
>   delete mode 100644 Documentation/cgroup-legacy/unified-hierarchy.txt
>   create mode 100644 Documentation/cgroup.txt
>

Looks good to me. For all three patches:

Acked-by: Zefan Li <lizefan@huawei.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web