mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Waiman Long <longman@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Phil Auld <pauld@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH-tip v3] sched: Use kfree_rcu() in do_set_cpus_allowed()
Date: Thu, 22 Dec 2022 21:25:12 +0100	[thread overview]
Message-ID: <Y6S9KBYQbbFIQFWa@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <56792f82-951e-04c5-f7ea-fbf9ab375eec@redhat.com>

On Thu, Dec 22, 2022 at 03:18:29PM -0500, Waiman Long wrote:

> > > @@ -8220,7 +8230,7 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
> > >   	struct affinity_context ac;
> > >   	struct cpumask *user_mask;
> > >   	struct task_struct *p;
> > > -	int retval;
> > > +	int retval, size;
> > >   	rcu_read_lock();
> > > @@ -8253,7 +8263,11 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
> > >   	if (retval)
> > >   		goto out_put_task;
> > > -	user_mask = kmalloc(cpumask_size(), GFP_KERNEL);
> > > +	/*
> > > +	 * See do_set_cpus_allowed() for the rcu_head usage.
> > > +	 */
> > > +	size = max_t(int, cpumask_size(), sizeof(struct rcu_head));
> > > +	user_mask = kmalloc(size, GFP_KERNEL);
> > >   	if (!user_mask) {
> > >   		retval = -ENOMEM;
> > >   		goto out_put_task;
> > AFAICT you forgot dup_user_cpus_ptr().
> 
> I haven't received any response from you for a while. So it is just a ping.

I was out sick :/

> Of course, I am aware that there is another dup_user_cpus_ptr() patch
> ouststanding. I will of course talk about that when you respond. I also have
> a pending rwsem patch series waiting for your review:-)

The point was that dup_user_cpus_ptr() also does an allocation and needs
to allocate the possibly bigger size too, no?

  reply	other threads:[~2022-12-22 20:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 16:39 Waiman Long
2022-12-21 19:22 ` Waiman Long
2022-12-22 19:32 ` Peter Zijlstra
2022-12-22 20:18   ` Waiman Long
2022-12-22 20:25     ` Peter Zijlstra [this message]
2022-12-22 21:03       ` Waiman Long

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=Y6S9KBYQbbFIQFWa@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=pauld@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.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®