* cgroup sysfs entry
@ 2013-04-25 19:39 David Shwatrz
[not found] ` <CAJJAcod9kNkdEvVf8GyHqqdzzC0Px1EdHwNtv68e-XtMXVo8zw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: David Shwatrz @ 2013-04-25 19:39 UTC (permalink / raw)
To: cgroups-u79uwXL29TY76Z2rM5mHXA
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?
Regards,
DavidS
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: cgroup sysfs entry
[not found] ` <CAJJAcod9kNkdEvVf8GyHqqdzzC0Px1EdHwNtv68e-XtMXVo8zw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-04-26 1:31 ` Li Zefan
0 siblings, 0 replies; 2+ messages in thread
From: Li Zefan @ 2013-04-26 1:31 UTC (permalink / raw)
To: David Shwatrz; +Cc: cgroups-u79uwXL29TY76Z2rM5mHXA
于 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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-26 1:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).