lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Wed, 8 May 2024 13:01:58 -0400
From: Waiman Long <longman@...hat.com>
To: Xuewen Yan <xuewen.yan94@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Xuewen Yan
 <xuewen.yan@...soc.com>, akpm@...ux-foundation.org, oleg@...hat.com,
 dylanbhatch@...gle.com, rick.p.edgecombe@...el.com, ke.wang@...soc.com,
 linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] sched/proc: Print user_cpus_ptr for task status


On 5/7/24 02:57, Xuewen Yan wrote:
>> These changes essentially reverts commit 851a723e45d1c("sched: Always
>> clear user_cpus_ptr in do_set_cpus_allowed()") except the additional
>> caller in the cpuset code.
>>
>> How about the following less invasive change?
>>
>>    diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index 7019a40457a6..646837eab70c 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -2796,21 +2796,24 @@ __do_set_cpus_allowed(struct task_struct *p,
>> struct affinity_context *ctx)
>>    }
>>
>>    /*
>> - * Used for kthread_bind() and select_fallback_rq(), in both cases the user
>> - * affinity (if any) should be destroyed too.
>> + * Used for kthread_bind() and select_fallback_rq(). Destroy user affinity
>> + * if no intersection with the new mask.
>>     */
>>    void do_set_cpus_allowed(struct task_struct *p, const struct cpumask
>> *new_mask)
>>    {
>>           struct affinity_context ac = {
>>                   .new_mask  = new_mask,
>>                   .user_mask = NULL,
>> -               .flags     = SCA_USER,  /* clear the user requested mask */
>> +               .flags     = 0,
>>           };
>>           union cpumask_rcuhead {
>>                   cpumask_t cpumask;
>>                   struct rcu_head rcu;
>>           };
>>
>> +       if (current->user_cpus_ptr &&
>> !cpumask_intersects(current->user_cpus_ptr, new_mask))
> Thanks for your suggestion, and I try it and as for me, it works well,
> but I change the "current" to p.
> I think “current” is inappropriate because what is changed here is the
> mask of p.
> It is possible that “p” and “current” are not equal.
>
> I would send the next patch later and add your Suggested-by. Thanks
> again for your advice!

You are right. It should be "p" instead of "current".

Thanks,
Longman


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ