public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Aleksa Sarai <cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org>
Cc: "Austin S Hemmelgarn"
	<ahferroin7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
	mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
	richard-/L3Ra7n9ekc@public.gmane.org,
	"Frédéric Weisbecker"
	<fweisbec-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH RFC 0/2] add nproc cgroup subsystem
Date: Sat, 28 Feb 2015 06:59:26 -0500	[thread overview]
Message-ID: <20150228115926.GA1005@htj.duckdns.org> (raw)
In-Reply-To: <CAOviyajSOY6kTiwTA+APf9VGT=Ui=0QQH6KUqwaxHB3ahuJk2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hello, Aleksa.

On Sat, Feb 28, 2015 at 08:26:34PM +1100, Aleksa Sarai wrote:
> I just want to quickly echo my support for this statement. Process IDs
> aren't limited by kernel memory, they're a hard-set limit. Thus they are

Process IDs become a hard global resource because we didn't switch to
long during 64bit transition and put an artifical global limit on it,
which allows it to affect system-wide operation while its memory
consumption is staying within practical range.

> a resource like other global resources (open files, etc). Now, while you

Unlike open files.

> can argue that it is possible to limit the amount of *effective*
> processes you can use in a cgroup through kmemcg (by limiting the amount
> of memory spent in storing task_struct data) -- that isn't limiting the
> usage of the *actual* resource (the fact you're limiting the number of
> PIDs is little more than a by-product).

No, the problem is not that.  The problem is that pid_t is, as a
resource, is decoupled from its backing resource - memory - by the
extra artificial and difficult-to-overcome limit put on it.  You are
saying something which is completely different from what Austin was
arguing.

> Also, If it wasn't an actual resource then why is RLIMIT_NPROC a thing?

One strong reason would be because we didn't have a way to account for
and limit the fundamental resources.  If you can fully contain and
control the consumption via rationing the underlying resource, there
isn't much point in controlling the upper layer constructs.

> To me, that indicates that PID limiting not an esoteric usecase and it
> should be possible to use the Linux kernel's home-grown accounting
> system to limit the number of PIDs in a cgroup. Otherwise you're stuck

Again, I think it's a lot more indicative of the fact that we didn't
have any way to control kernel side memory consumption and pids and
open files were one of the things which are relatively easy to
implement policy-wise.

> in a weird world where you *can* limit the number of processes in a
> process tree but *not* the number of processes in a cgroup.

I'm not sold on the idea of replicating the features of ulimit in
cgroups.  ulimit is a mixed bag of relatively easily implementable
resource limits and their behaviors are a combination of resource
limits, per-user usage policies, and per-process behavior safetynets.
The only part translatable to cgroups is actual resource related part
and even among those we should identify what are actual resources
which can't be mapped to consumption of other fundamental resources.

> >> In general, I'm pretty strongly against adding controllers for things
> >> which aren't fundamental resources in the system.  What's next?  Open
> >> files?  Pipe buffer?  Number of flocks?  Number of session leaders or
> >> program groups?
> >>
> > PID's are a fundamental resource, you run out and it's an only marginally
> > better situation than OOM, namely, if you don't already have a shell open
> > which has kill builtin (because you can't fork), or have some other reliable
> > way to terminate processes without forking, you are stuck either waiting for
> > the problem to resolve itself, or have to reset the system.
> 
> I couldn't agree more. PIDs are a fundamental resource because there is
> a hard limit on the amount of PIDs you can have in any one system. Once
> you've exhausted that limit, there's not much you can do apart from
> doing the SYSRQ dance.

The reason why this holds is because we can hit the global limit way
earlier than a practically sized kmem consumption limits can kick in.

Thanks.

-- 
tejun

  parent reply	other threads:[~2015-02-28 11:59 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23  3:08 [PATCH RFC 0/2] add nproc cgroup subsystem Aleksa Sarai
2015-02-23  3:08 ` [PATCH RFC 1/2] cgroups: allow a cgroup subsystem to reject a fork Aleksa Sarai
2015-02-23 14:49   ` Peter Zijlstra
2015-02-23  3:08 ` [PATCH RFC 2/2] cgroups: add an nproc subsystem Aleksa Sarai
2015-02-27 11:49 ` [PATCH RFC 0/2] add nproc cgroup subsystem Tejun Heo
     [not found]   ` <20150227114940.GB3964-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2015-02-27 13:46     ` Richard Weinberger
     [not found]       ` <54F07525.4050100-/L3Ra7n9ekc@public.gmane.org>
2015-02-27 13:52         ` Tejun Heo
2015-02-27 16:42     ` Austin S Hemmelgarn
     [not found]       ` <54F09E62.8000007-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-27 17:06         ` Tejun Heo
     [not found]           ` <20150227170640.GK3964-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2015-02-27 17:25             ` Tim Hockin
2015-02-27 17:45               ` Tejun Heo
     [not found]                 ` <20150227174503.GM3964-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2015-02-27 17:56                   ` Tejun Heo
2015-02-27 21:45                   ` Tim Hockin
2015-02-27 21:49                     ` Tejun Heo
     [not found]                       ` <CAAAKZwsCc8BtFx58KMFpRTohU81oCBeGVOPGMJrjJt9q5upKfQ@mail.gmail.com>
2015-02-28 16:57                         ` Tejun Heo
     [not found]                           ` <20150228165706.GS3964-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2015-02-28 22:26                             ` Tim Hockin
     [not found]                               ` <CAAAKZwv=idxvrffHx2QyW=PGH4k42ckq-VLJGQrXkeQ6NmByRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-02-28 22:50                                 ` Tejun Heo
     [not found]                                   ` <20150228225036.GA4597-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2015-03-01  4:46                                     ` Tim Hockin
2015-02-28 23:11                                 ` Johannes Weiner
2015-02-27 18:49             ` Austin S Hemmelgarn
     [not found]               ` <54F0BC51.4050506-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-27 19:35                 ` Tejun Heo
2015-02-28  9:26                 ` Aleksa Sarai
     [not found]                   ` <CAOviyajSOY6kTiwTA+APf9VGT=Ui=0QQH6KUqwaxHB3ahuJk2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-02-28 11:59                     ` Tejun Heo [this message]
     [not found]                       ` <CAAAKZws45c3PhFQMGrm_K+OZV+KOyGV9sXTakHcTfNP1kHxzOQ@mail.gmail.com>
     [not found]                         ` <CAAAKZws45c3PhFQMGrm_K+OZV+KOyGV9sXTakHcTfNP1kHxzOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-02-28 16:43                           ` Tejun Heo
2015-03-02 13:13                             ` Austin S Hemmelgarn
     [not found]                               ` <54F461F3.3030903-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-02 13:31                                 ` Aleksa Sarai
     [not found]                                   ` <CAOviyahKJthwLTND51HhaRNB_KJC60T7HFHjdqPZf3pQmAUAhw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-02 13:54                                     ` Tejun Heo
2015-03-02 13:49                               ` Tejun Heo
2015-02-27 17:12       ` Tim Hockin
     [not found]         ` <CAO_RewbeTbMuqVG5wsui_gHwrdgqjF0KLk6yr5a3bb76VOkofg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-02-27 17:15           ` Tejun Heo
2015-03-04 20:23 ` [PATCH v3 0/2] cgroup: add pids subsystem Aleksa Sarai
2015-03-04 20:23   ` [PATCH v3 1/2] cgroups: allow a cgroup subsystem to reject a fork Aleksa Sarai
2015-03-04 20:23   ` [PATCH v3 2/2] cgroups: add a pids subsystem Aleksa Sarai
2015-03-05  8:39     ` Aleksa Sarai
2015-03-05 14:37     ` Marian Marinov
     [not found] ` <1424660891-12719-1-git-send-email-cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org>
2015-02-27  4:17   ` [RFC PATCH v2 0/2] add nproc cgroup subsystem Aleksa Sarai
     [not found]     ` <1425010639-16492-1-git-send-email-cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org>
2015-02-27  4:17       ` [PATCH v2 1/2] cgroups: allow a cgroup subsystem to reject a fork Aleksa Sarai
     [not found]         ` <1425010639-16492-2-git-send-email-cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org>
2015-03-09  3:06           ` Tejun Heo
     [not found]             ` <CAOviyaip7Faz98YWzGoTaXGYVb72sfD+ZL4Xa89reU9+=43jFA@mail.gmail.com>
     [not found]               ` <20150309065902.GP13283@htj.duckdns.org>
     [not found]                 ` <20150309065902.GP13283-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2015-03-10  8:19                   ` Aleksa Sarai
     [not found]                     ` <CAOviyaj3mf66ho15WrD8qB=ECxKWYTAkWodxWaFVMWeZG4d0FQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-10 12:47                       ` Tejun Heo
     [not found]                         ` <20150310124701.GB28730-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2015-03-10 14:51                           ` Aleksa Sarai
     [not found]                             ` <CAOviyai7yJrbGb+uYpK35tw7R-KM0jWQ-BmhpyTqnRFJsVYdUA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-10 15:17                               ` Tejun Heo
2015-03-11  5:16                                 ` Aleksa Sarai
2015-03-11 11:46                                   ` Tejun Heo
2015-03-11 23:47                   ` Aleksa Sarai
     [not found]                     ` <CAOviyaj55Yqahz75Gy5=yjFteeKFp7746=80-Ufww2E62Ads_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-12  1:25                       ` Tejun Heo
2015-02-27  4:17     ` [PATCH v2 2/2] cgroups: add an nproc subsystem Aleksa Sarai
     [not found]       ` <1425010639-16492-3-git-send-email-cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org>
2015-03-02 15:22         ` Tejun Heo
     [not found]           ` <20150302152205.GC17694-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2015-03-09  1:49             ` Zefan Li
     [not found]               ` <54FCFC39.6050900-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2015-03-09  2:34                 ` Tejun Heo
2015-03-06  1:45   ` [PATCH v4 0/2] cgroup: add pids subsystem Aleksa Sarai
2015-03-06  1:45     ` [PATCH v4 1/2] cgroups: allow a cgroup subsystem to reject a fork Aleksa Sarai
     [not found]     ` <1425606357-6337-1-git-send-email-cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org>
2015-03-06  1:45       ` [PATCH v4 2/2] cgroups: add a pids subsystem Aleksa Sarai
     [not found]         ` <1425606357-6337-3-git-send-email-cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org>
2015-03-09  3:34           ` Tejun Heo
     [not found]             ` <20150309033405.GE13283-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2015-03-09  3:39               ` Tejun Heo
2015-03-09 18:58               ` Austin S Hemmelgarn
     [not found]                 ` <54FDED43.4050908-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-09 19:51                   ` Tejun Heo
2015-03-10  8:10                   ` Aleksa Sarai
2015-03-10 11:32                     ` Austin S Hemmelgarn
     [not found]                       ` <54FED651.6040100-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-10 12:31                         ` Aleksa Sarai
     [not found]                           ` <CAOviyagpCNcAN4hdhsxffdpE+yDmw+NXx+FikTe64GJ1hQeXhQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-11 15:13                             ` Austin S Hemmelgarn
     [not found]                               ` <55005BAC.9060405-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-12  2:28                                 ` Aleksa Sarai
2015-03-12 15:35                                   ` Austin S Hemmelgarn
2015-03-12  3:47                               ` Tejun Heo
2015-03-09  3:08       ` [PATCH v4 0/2] cgroup: add " Tejun Heo

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=20150228115926.GA1005@htj.duckdns.org \
    --to=tj-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=ahferroin7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org \
    --cc=fweisbec-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
    --cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=richard-/L3Ra7n9ekc@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