[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <828245eb-66ee-a2e3-c9ab-7cbc90044de3@redhat.com>
Date: Thu, 22 Dec 2022 16:03:31 -0500
From: Waiman Long <longman@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Phil Auld <pauld@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH-tip v3] sched: Use kfree_rcu() in do_set_cpus_allowed()
On 12/22/22 15:25, Peter Zijlstra wrote:
> 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 :/
I am sorry to hear that. Hope you are all right now.
>
>> 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?
Oh, yes. I missed that. I will combine the two patches into a patch series.
Thanks,
Longman
Powered by blists - more mailing lists