Linux-Doc Archive on lore.kernel.org
 help / color / Atom feed
* [RFC] docs/admin-guide/cgroup-v2: Add hugetlb rsvd files
@ 2021-04-16 14:11 Odin Ugedal
  2021-04-16 20:45 ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Odin Ugedal @ 2021-04-16 14:11 UTC (permalink / raw)
  To: corbet; +Cc: cgroups, linux-doc, Odin Ugedal

Add missing docs about reservation accounting for hugetlb in cgroup v2.

Signed-off-by: Odin Ugedal <odin@uged.al>
---
RFC: This is linking from cgroup-v1 docs, and that is probably not
optimal. The information about the difference between reservation
accounting and page fault accounting is pretty hard to make short.

I think we have four ways to do it, but I don't know what is
most optimal:

- Link from cgroup-v2 to cgroup-v1 (this patch)
- Have a separate description for both v1 and v2
- Move description from cgroup-v1 to cgroup-v2, and link from v1 to
  v2.
- Move info from cgroup-v1 to admin-guide/mm/hugetlbpage or
  vm/hugetlbfs_reserv, and link from cgroup to them.

admin-guide/cgroup-v1/hugetlb need some formatting anyhow also, will fix
that in the same patchset as this. Together with describing
<hugepagesize> in cgroup-v2.

 Documentation/admin-guide/cgroup-v2.rst | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
index 64c62b979f2f..0a29cd46b1ab 100644
--- a/Documentation/admin-guide/cgroup-v2.rst
+++ b/Documentation/admin-guide/cgroup-v2.rst
@@ -2143,12 +2143,31 @@ RDMA Interface Files
 HugeTLB
 -------
 
-The HugeTLB controller allows to limit the HugeTLB usage per control group and
-enforces the controller limit during page fault.
+The "HugeTLB" controller regulates usage of huge pages. The controller
+supports two forms of accounting: page fault accounting and reservation
+accounting. See
+:ref:`Documentation/admin-guide/cgroup-v1/hugetlb.rst <cgroup-v1-hugetlb>`
+for more details.
+
 
 HugeTLB Interface Files
 ~~~~~~~~~~~~~~~~~~~~~~~
 
+  hugetlb.<hugepagesize>.rsvd.current
+	Show current reservations and no-reserve faults for "hugepagesize"
+	hugetlb.  It exists for all the cgroup except root.
+
+  hugetlb.<hugepagesize>.rsvd.max
+	Set/show the hard limit of reservations and no-reserve faults for
+	"hugepagesize" hugetlb. The default value is "max".
+	It exists for all the cgroup except root.
+
+  hugetlb.<hugepagesize>.rsvd.events
+	A read-only flat-keyed file which exists on non-root cgroups.
+
+	  max
+		The number of allocation failure due to HugeTLB reservation limit
+
   hugetlb.<hugepagesize>.current
 	Show current usage for "hugepagesize" hugetlb.  It exists for all
 	the cgroup except root.
-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] docs/admin-guide/cgroup-v2: Add hugetlb rsvd files
  2021-04-16 14:11 [RFC] docs/admin-guide/cgroup-v2: Add hugetlb rsvd files Odin Ugedal
@ 2021-04-16 20:45 ` Tejun Heo
  2021-04-19 14:51   ` Johannes Weiner
  0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2021-04-16 20:45 UTC (permalink / raw)
  To: Odin Ugedal
  Cc: corbet, cgroups, linux-doc, Johannes Weiner, Michal Hocko,
	Vladimir Davydov

(cc'ing memcg maintainers)

On Fri, Apr 16, 2021 at 04:11:46PM +0200, Odin Ugedal wrote:
> Add missing docs about reservation accounting for hugetlb in cgroup v2.
> 
> Signed-off-by: Odin Ugedal <odin@uged.al>
> ---
> RFC: This is linking from cgroup-v1 docs, and that is probably not
> optimal. The information about the difference between reservation
> accounting and page fault accounting is pretty hard to make short.
> 
> I think we have four ways to do it, but I don't know what is
> most optimal:
> 
> - Link from cgroup-v2 to cgroup-v1 (this patch)
> - Have a separate description for both v1 and v2
> - Move description from cgroup-v1 to cgroup-v2, and link from v1 to
>   v2.

This would be my preference but I don't really mind the other way around
that much.

> - Move info from cgroup-v1 to admin-guide/mm/hugetlbpage or
>   vm/hugetlbfs_reserv, and link from cgroup to them.

What do others think?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] docs/admin-guide/cgroup-v2: Add hugetlb rsvd files
  2021-04-16 20:45 ` Tejun Heo
@ 2021-04-19 14:51   ` Johannes Weiner
  2021-04-25  9:22     ` Odin Ugedal
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Weiner @ 2021-04-19 14:51 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Odin Ugedal, corbet, cgroups, linux-doc, Michal Hocko, Vladimir Davydov

On Fri, Apr 16, 2021 at 04:45:38PM -0400, Tejun Heo wrote:
> (cc'ing memcg maintainers)
> 
> On Fri, Apr 16, 2021 at 04:11:46PM +0200, Odin Ugedal wrote:
> > Add missing docs about reservation accounting for hugetlb in cgroup v2.
> > 
> > Signed-off-by: Odin Ugedal <odin@uged.al>
> > ---
> > RFC: This is linking from cgroup-v1 docs, and that is probably not
> > optimal. The information about the difference between reservation
> > accounting and page fault accounting is pretty hard to make short.
> > 
> > I think we have four ways to do it, but I don't know what is
> > most optimal:
> > 
> > - Link from cgroup-v2 to cgroup-v1 (this patch)
> > - Have a separate description for both v1 and v2
> > - Move description from cgroup-v1 to cgroup-v2, and link from v1 to
> >   v2.
> 
> This would be my preference but I don't really mind the other way around
> that much.

v1/hugetlb.rst is quite verbose, and some things are implementation
details. I'm not sure we want all that in the cgroup2 documentation.

My preference would be to first try to write a version of the doc in
cgroup2's briefer style, and then, depending on how that works out,
see whether we can delete (replace with link) the cgroup1 text, or
keep it for archiving purposes.

v1/hugetlb doc items that seem unnecesary to keep in v2:

- how to mount the cgroupfs, create cgroups, and move tasks into it

- the page fault accounting description could be compressed a
  bit. maybe drop the part about it being the admin's job to avoid
  sigbus by being careful with the allocations. that's obvious imo
  when you simply describe the sigbus semantics.

- likewise, reservation accounting can be briefer too. there is quite
  a bit of opinion in there that could probably be cut short. maybe a
  one-liner that says "mmap-time accounting gives userspace easier
  error handling - if in doubt, use reservation accounting" or so.

- caveats with shared memory: not sure this is needed at all, but if
  so, it can be a one liner saying "hugetlb uses the same first-hit
  semantics as the memory controller (see Memory Ownership)"

- Caveats with HugeTLB cgroup offline: this is an implementation
  detail that i don't think is actionable information for users

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] docs/admin-guide/cgroup-v2: Add hugetlb rsvd files
  2021-04-19 14:51   ` Johannes Weiner
@ 2021-04-25  9:22     ` Odin Ugedal
  0 siblings, 0 replies; 4+ messages in thread
From: Odin Ugedal @ 2021-04-25  9:22 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Tejun Heo, Odin Ugedal, Jonathan Corbet,
	open list:CONTROL GROUP (CGROUP),
	open list:DOCUMENTATION, Michal Hocko, Vladimir Davydov

> My preference would be to first try to write a version of the doc in
> cgroup2's briefer style, and then, depending on how that works out,
> see whether we can delete (replace with link) the cgroup1 text, or
> keep it for archiving purposes.

Thanks! That sounds like the best way to do it! Will take a look, and
post an updated patch.

Odin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 14:11 [RFC] docs/admin-guide/cgroup-v2: Add hugetlb rsvd files Odin Ugedal
2021-04-16 20:45 ` Tejun Heo
2021-04-19 14:51   ` Johannes Weiner
2021-04-25  9:22     ` Odin Ugedal

Linux-Doc Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-doc/0 linux-doc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-doc linux-doc/ https://lore.kernel.org/linux-doc \
		linux-doc@vger.kernel.org
	public-inbox-index linux-doc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-doc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git