public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: chenridong <chenridong@huawei.com>,
	Kamalesh Babulal <kamalesh.babulal@oracle.com>,
	tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org,
	adityakali@google.com, sergeh@kernel.org, mkoutny@suse.com
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] cgroup/cpuset: add dec_attach_in_progress helper
Date: Thu, 25 Jul 2024 15:07:56 -0400	[thread overview]
Message-ID: <b45c24d2-98ee-4ecc-8d7d-6ac5dfa65c17@redhat.com> (raw)
In-Reply-To: <de6958aa-27f8-4baa-b76d-88266d009f81@huawei.com>


On 7/25/24 07:40, chenridong wrote:
>
>
> On 2024/7/25 19:01, Kamalesh Babulal wrote:
>>
>>
>> On 7/25/24 7:25 AM, Chen Ridong wrote:
>>> There are several functions to decrease attach_in_progress, and they
>>> will wake up cpuset_attach_wq when attach_in_progress is zero. So,
>>> add a helper to make it concise.
>>>
>>> Signed-off-by: Chen Ridong <chenridong@huawei.com>
>>> ---
>>>   kernel/cgroup/cpuset.c | 28 +++++++++++++++-------------
>>>   1 file changed, 15 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
>>> index d4322619e59a..c241845694ac 100644
>>> --- a/kernel/cgroup/cpuset.c
>>> +++ b/kernel/cgroup/cpuset.c
>>> @@ -490,6 +490,17 @@ static inline void 
>>> check_insane_mems_config(nodemask_t *nodes)
>>>       }
>>>   }
>>>   +/*
>>> + * decrease cs->attach_in_progress.
>>> + * wake_up cpuset_attach_wq if cs->attach_in_progress==0.
>>
>> In the description, adding locking constraint of cpuset_mutex would 
>> be helpful.
>> Something like "cpuset_mutex must be held by the caller."
>>
> Thank you, I will to that.
>>> + */
>>> +static inline void dec_attach_in_progress(struct cpuset *cs)
>>> +{
>>> +    cs->attach_in_progress--;
>>> +    if (!cs->attach_in_progress)
>>> +        wake_up(&cpuset_attach_wq);
>>> +}
>>> +

I would suggested a dec_attach_in_progress_locked() and a 
dec_attach_in_progress() helpers. The dec_attach_in_progress() helper 
acquires the cpuset_mutex and call dec_attach_in_progress_locked(). 
Inside the dec_attach_in_progress_locked(), you can either add a comment 
about requiring cpuset_mutex held or add a 
lockdep_assert_held(&cpuset_mutex).

Cheers,
Longman



  reply	other threads:[~2024-07-25 19:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-25  1:55 [PATCH -next] cgroup/cpuset: add dec_attach_in_progress helper Chen Ridong
2024-07-25 11:01 ` Kamalesh Babulal
2024-07-25 11:40   ` chenridong
2024-07-25 19:07     ` Waiman Long [this message]
2024-07-26  1:00       ` chenridong

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=b45c24d2-98ee-4ecc-8d7d-6ac5dfa65c17@redhat.com \
    --to=longman@redhat.com \
    --cc=adityakali@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chenridong@huawei.com \
    --cc=hannes@cmpxchg.org \
    --cc=kamalesh.babulal@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=mkoutny@suse.com \
    --cc=sergeh@kernel.org \
    --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