mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Ripduman Sohan <ripduman.sohan@cl.cam.ac.uk>
Cc: tj@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] workqueue: Restore cpus_allowed mask for sleeping workqueue rescue threads
Date: Wed, 31 Aug 2011 17:20:41 +0200	[thread overview]
Message-ID: <1314804041.3578.42.camel@twins> (raw)
In-Reply-To: <1314796663-4215-1-git-send-email-ripduman.sohan@cl.cam.ac.uk>

On Wed, 2011-08-31 at 14:17 +0100, Ripduman Sohan wrote:
> Rescuer threads may be migrated (and are bound) to particular CPUs when
> active.  However, the allowed_cpus mask is not restored when they return
> to sleep rendering inconsistent the presented and actual set of CPUs the
> process may potentially run on.  This patch fixes this oversight by
> recording the allowed_cpus mask for rescuer threads when it enters the
> rescuer_thread() main loop and restoring it every time the thread sleeps.
> 
> Signed-off-by: Ripduman Sohan <ripduman.sohan@cl.cam.ac.uk>
> ---
>  kernel/workqueue.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 25fb1b0..0a4e785 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -2031,6 +2031,7 @@ static int rescuer_thread(void *__wq)
>  	struct list_head *scheduled = &rescuer->scheduled;
>  	bool is_unbound = wq->flags & WQ_UNBOUND;
>  	unsigned int cpu;
> +        cpumask_t allowed_cpus = current->cpus_allowed;

except you cannot just allocate a cpumask_t like that on the stack,
those things can be massive.

>  	set_user_nice(current, RESCUER_NICE_LEVEL);
>  repeat:
> @@ -2078,6 +2079,8 @@ repeat:
>  		spin_unlock_irq(&gcwq->lock);
>  	}
>  
> +        set_cpus_allowed_ptr(current, &allowed_cpus);
> +
>  	schedule();
>  	goto repeat;
>  }


  reply	other threads:[~2011-08-31 15:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31 13:17 Ripduman Sohan
2011-08-31 15:20 ` Peter Zijlstra [this message]
2011-09-01 13:36 Ripduman Sohan
2011-09-02  0:29 ` Tejun Heo
2011-09-15 16:14   ` Ripduman Sohan
2011-09-17  0:29     ` Tejun Heo
2011-09-18  6:36     ` Gilad Ben-Yossef
2011-09-24  3:07       ` Tejun Heo
2011-09-25  6:02         ` Gilad Ben-Yossef
2011-09-30  8:09           ` Tejun Heo
2011-09-30  8:54             ` Ripduman Sohan
2011-09-30  8:57               ` Tejun Heo
2011-09-30  8:59                 ` Ripduman Sohan
2011-10-01  1:10                   ` 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=1314804041.3578.42.camel@twins \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ripduman.sohan@cl.cam.ac.uk \
    --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®