Messages in this thread | | | From | (Eric W. Biederman) | Date | Sun, 22 Sep 2019 16:24:10 -0500 | Subject | Re: threads-max observe limits |
| |
Michal Hocko <mhocko@kernel.org> writes:
> From 711000fdc243b6bc68a92f9ef0017ae495086d39 Mon Sep 17 00:00:00 2001 > From: Michal Hocko <mhocko@suse.com> > Date: Sun, 22 Sep 2019 08:45:28 +0200 > Subject: [PATCH] kernel/sysctl.c: do not override max_threads provided by > userspace > > Partially revert 16db3d3f1170 ("kernel/sysctl.c: threads-max observe limits") > because the patch is causing a regression to any workload which needs to > override the auto-tuning of the limit provided by kernel. > > set_max_threads is implementing a boot time guesstimate to provide a > sensible limit of the concurrently running threads so that runaways will > not deplete all the memory. This is a good thing in general but there > are workloads which might need to increase this limit for an application > to run (reportedly WebSpher MQ is affected) and that is simply not > possible after the mentioned change. It is also very dubious to override > an admin decision by an estimation that doesn't have any direct relation > to correctness of the kernel operation. > > Fix this by dropping set_max_threads from sysctl_max_threads so any > value is accepted as long as it fits into MAX_THREADS which is important > to check because allowing more threads could break internal robust futex > restriction. While at it, do not use MIN_THREADS as the lower boundary > because it is also only a heuristic for automatic estimation and admin > might have a good reason to stop new threads to be created even when > below this limit. > > Fixes: 16db3d3f1170 ("kernel/sysctl.c: threads-max observe limits") > Cc: stable > Signed-off-by: Michal Hocko <mhocko@suse.com> Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com>
> --- > kernel/fork.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/fork.c b/kernel/fork.c > index 2852d0e76ea3..ef865be37e98 100644 > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -2929,7 +2929,7 @@ int sysctl_max_threads(struct ctl_table *table, int write, > struct ctl_table t; > int ret; > int threads = max_threads; > - int min = MIN_THREADS; > + int min = 1; > int max = MAX_THREADS; > > t = *table; > @@ -2941,7 +2941,7 @@ int sysctl_max_threads(struct ctl_table *table, int write, > if (ret || !write) > return ret; > > - set_max_threads(threads); > + max_threads = threads; > > return 0; > } > -- > 2.20.1
| |