From: Waiman Long <longman@redhat.com>
To: Xuewen Yan <xuewen.yan94@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Xuewen Yan <xuewen.yan@unisoc.com>,
akpm@linux-foundation.org, oleg@redhat.com,
dylanbhatch@google.com, rick.p.edgecombe@intel.com,
ke.wang@unisoc.com, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] sched/proc: Print user_cpus_ptr for task status
Date: Wed, 8 May 2024 13:01:58 -0400 [thread overview]
Message-ID: <e7701346-6134-4bdc-8ccc-530be314a517@redhat.com> (raw)
In-Reply-To: <CAB8ipk-yz+6X2E7BsJmNqVgZDjE8NkJFNdqFU+WLieKVhFaCuA@mail.gmail.com>
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
prev parent reply other threads:[~2024-05-09 4:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-29 8:46 [PATCH] sched/proc: Print user_cpus_ptr for task status Xuewen Yan
2024-04-29 12:10 ` Peter Zijlstra
2024-05-06 8:04 ` Xuewen Yan
2024-05-06 18:03 ` Waiman Long
2024-05-07 6:57 ` Xuewen Yan
2024-05-08 17:01 ` Waiman Long [this message]
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=e7701346-6134-4bdc-8ccc-530be314a517@redhat.com \
--to=longman@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dylanbhatch@google.com \
--cc=ke.wang@unisoc.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=xuewen.yan94@gmail.com \
--cc=xuewen.yan@unisoc.com \
/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;
as well as URLs for NNTP newsgroup(s).