From: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: David Shwatrz <dshwatrz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: cgroup sysfs entry
Date: Fri, 26 Apr 2013 09:31:01 +0800 [thread overview]
Message-ID: <5179D8D5.4050003@huawei.com> (raw)
In-Reply-To: <CAJJAcod9kNkdEvVf8GyHqqdzzC0Px1EdHwNtv68e-XtMXVo8zw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
于 2013/4/26 3:39, David Shwatrz 写道:
> Hello,
>
> I have a question about cgroup implementation:
>
> The /sys/fs/cgroup entry is created in kernel/cgroup.c:
>
> static struct kobject *cgroup_kobj;
>
> cgroup_init(void) {
> ...
> cgroup_kobj = kobject_create_and_add("cgroup", fs_kobj);
> if (!cgroup_kobj) {
> err = -ENOMEM;
> goto out;
> }
>
> }
>
> I wondered about this two points:
> 1) why is the /sys/fs/cgroup entry created at all?
> 2) why is this done as a sysfs entry.
>
> The cgroup_kobj is not used anywhere in this module apart from
> its creation above (and destroying if we later fail with
> register_filesystem() in this same method). I don't see anywhere usage
> of syfs API to create files underneath
> it. In fact, the entries beneath it are created by mkdir of admin or
> systemd code. so what's the point of it being a sysfs entry ? wouldn't
> simply mkdir be ok ? and why under /sys/fs?
>
> Since cgroups can be mounted by definition on every path, why this is needed?
>
It's supposed to be the standard place to mount cgroupfs.
commit 676db4af043014e852f67ba0349dae0071bd11f3
Author: Greg KH <gregkh-l3A5Bk7waGM@public.gmane.org>
Date: Thu Aug 5 13:53:35 2010 -0700
cgroupfs: create /sys/fs/cgroup to mount cgroupfs on
We really shouldn't be asking userspace to create new root filesystems.
So follow along with all of the other in-kernel filesystems, and provide
a mount point in sysfs.
For cgroupfs, this should be in /sys/fs/cgroup/ This change provides
that mount point when the cgroup filesystem is registered in the kernel.
Acked-by: Paul Menage <menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Acked-by: Dhaval Giani <dhaval.giani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: Lennart Poettering <lennart-mdGvqq1h2p+GdvJs77BJ7Q@public.gmane.org>
Cc: Kay Sievers <kay.sievers-tD+1rO4QERM@public.gmane.org>
Signed-off-by: Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>
prev parent reply other threads:[~2013-04-26 1:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-25 19:39 cgroup sysfs entry David Shwatrz
[not found] ` <CAJJAcod9kNkdEvVf8GyHqqdzzC0Px1EdHwNtv68e-XtMXVo8zw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-26 1:31 ` Li Zefan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5179D8D5.4050003@huawei.com \
--to=lizefan-hv44wf8li93qt0dzr+alfa@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dshwatrz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).