mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: "Michal Koutný" <mkoutny@suse.com>
Cc: Tejun Heo <tj@kernel.org>, Lai Jiangshan <jiangshanlai@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC 2/5] workqueue: Warn when a new worker could not be created
Date: Thu, 16 Feb 2023 10:43:13 +0100	[thread overview]
Message-ID: <Y+36sT088JAEwUCe@alley> (raw)
In-Reply-To: <20230215180204.GP1757@blackbody.suse.cz>

On Wed 2023-02-15 19:02:04, Michal Koutný wrote:
> Hello.
> 
> On Wed, Feb 01, 2023 at 02:45:40PM +0100, Petr Mladek <pmladek@suse.com> wrote:
> >    + the system reached PID limit
> or threads-max limit.
> 
> FTR, I was once considering something like
> 
> --->8---
> diff --git a/kernel/fork.c b/kernel/fork.c
> index 867b46d6fd0a..bba05ecc3765 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -1684,8 +1684,10 @@ static __latent_entropy struct task_struct *copy_process(
>          * to stop root fork bombs.
>          */
>         retval = -EAGAIN;
> -       if (nr_threads >= max_threads)
> +       if (nr_threads >= max_threads) {
> +               printk_once(KERN_INFO "clone failed due to threads-max limit\n");
>                 goto bad_fork_cleanup_count;
> +       }
> 
>         delayacct_tsk_init(p);  /* Must remain after dup_task_struct() */
>         p->flags &= ~(PF_SUPERPRIV | PF_WQ_WORKER | PF_IDLE);
> @@ -1816,6 +1818,7 @@ static __latent_entropy struct task_struct *copy_process(
>         if (pid != &init_struct_pid) {
>                 pid = alloc_pid(p->nsproxy->pid_ns_for_children);
>                 if (IS_ERR(pid)) {
> +                       printk_once(KERN_INFO "fork failed to find pid\n");
>                         retval = PTR_ERR(pid);
>                         goto bad_fork_cleanup_thread;
>                 }
> --->8---
> 
> Effects of the global limits on anything but kthreads should be much less
> important and easier to troubleshoot anyway.
> Covering kworkers with your changes should be useful and substitute my idea
> above.

I was not brave enough to touch kernel/fork.c.

> Take that as my support for this patch (from my perspective reporting
> *_once would be enough to guide a troubleshooter).

My experience is that users often send logs with many stall reports and
the earlier messages are missing/lost. This is why I wanted to repeat
them.

Anyway, thanks for the support. I am going to send v2 when time permits.

Best Regards,
Petr

  reply	other threads:[~2023-02-16  9:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01 13:45 [RFC 0/5] workqueue: Debugging improvements Petr Mladek
2023-02-01 13:45 ` [RFC 1/5] workqueue: Fix hung time report of worker pools Petr Mladek
2023-02-01 13:45 ` [RFC 2/5] workqueue: Warn when a new worker could not be created Petr Mladek
2023-02-02 23:30   ` Tejun Heo
2023-02-03 14:10     ` Petr Mladek
2023-02-03 19:29       ` Tejun Heo
2023-02-15 18:02   ` Michal Koutný
2023-02-16  9:43     ` Petr Mladek [this message]
2023-02-01 13:45 ` [RFC 3/5] workqueue: Interrupted create_worker() is not a repeated event Petr Mladek
2023-02-01 13:45 ` [RFC 4/5] workqueue: Warn when a rescuer could not be created Petr Mladek
2023-02-01 13:45 ` [RFC 5/5] workqueue: Print backtraces from CPUs with hung CPU bound workqueues Petr Mladek
2023-02-02 23:45   ` Tejun Heo
2023-02-03 14:26     ` Petr Mladek

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=Y+36sT088JAEwUCe@alley \
    --to=pmladek@suse.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkoutny@suse.com \
    --cc=tj@kernel.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

all inboxes | Powered by JetHome®