From: Waiman Long <longman@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: Zefan Li <lizefan.x@bytedance.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.com>,
Frederic Weisbecker <frederic@kernel.org>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
Mrunal Patel <mpatel@redhat.com>,
Ryan Phillips <rphillips@redhat.com>,
Brent Rowsell <browsell@redhat.com>,
Peter Hunt <pehunt@redhat.com>
Subject: Re: [PATCH-cgroup 2/2] cgroup/cpuset: Include isolated cpuset CPUs in cpu_is_isolated() check
Date: Wed, 29 Nov 2023 11:01:04 -0500 [thread overview]
Message-ID: <b6f88157-cf5e-4c7b-99f3-1944b4e7ebde@redhat.com> (raw)
In-Reply-To: <ZWZl0uvqeZ-fR1O9@slm.duckdns.org>
On 11/28/23 17:12, Tejun Heo wrote:
> Hello,
>
> On Tue, Nov 28, 2023 at 01:32:53PM -0500, Waiman Long wrote:
>> On 11/28/23 11:56, Tejun Heo wrote:
>>> Hello,
>>>
>>> On Sun, Nov 26, 2023 at 11:19:56PM -0500, Waiman Long wrote:
>>>> +bool cpuset_cpu_is_isolated(int cpu)
>>>> +{
>>>> + unsigned int seq;
>>>> + bool ret;
>>>> +
>>>> + do {
>>>> + seq = read_seqcount_begin(&isolcpus_seq);
>>>> + ret = cpumask_test_cpu(cpu, isolated_cpus);
>>>> + } while (read_seqcount_retry(&isolcpus_seq, seq));
>>>> + return ret;
>>>> +}
>>>> +EXPORT_SYMBOL_GPL(cpuset_cpu_is_isolated);
>>> We're testing a bit in a bitmask. I don't think we need to worry about value
>>> integrity from RMW updates being broken up. ie. We can just test the bit
>>> without seqlock and drop the first patch?
>> My concern is that if we have an isolated partition with a set of isolated
>> CPUs (say 2-4), I don't want any addition, deletion of changes made to
>> another isolated partition affects the test of the pre-existing one. Testing
>> result of the partition being change is fair game.
>>
>> Depending on how the cpumask operators are implemented, we may not have a
>> guarantee that testing CPU 2, for instance, will always return true. That is
> Can you please elaborate this part a bit? I'm having a difficult time
> imagining the sequence of operations where this would matter but that could
> easily be me not being familiar with the details.
I may be a bit paranoid about incorrect result due to racing as I had
been burned before. Just testing a bit in the bitmask may probably be
OK. I don't think it will be a problem for x86, but I am less certain
about other more exotic architectures like arm64 or PPC which I am less
familiar about. I add a seqcount for synchronization just for the peace
of mind. I can take the seqcount out if you don't it is necessary.
I have also been thinking about an alternative helper that returns the
whole isolated cpumask since in both cases where cpu_is_isolated() is
used, we will have to iterate all the possible CPUs anyway, it will be
more efficient to have the whole cpumask available. In that case, we may
want to have a seqcount to avoid returning an intermediate result.
Anyway, this is just a thought for now, I am not planning to do that at
the moment.
Cheers,
Longman
next prev parent reply other threads:[~2023-11-29 16:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-27 4:19 [PATCH-cgroup 0/2] cgroup/cpuset: Include isolated cpuset CPUs in cpu_is_isolated() Waiman Long
2023-11-27 4:19 ` [PATCH-cgroup 1/2] cgroup/cpuset: Make callback_lock a raw_spinlock_t Waiman Long
2023-11-27 4:19 ` [PATCH-cgroup 2/2] cgroup/cpuset: Include isolated cpuset CPUs in cpu_is_isolated() check Waiman Long
2023-11-28 16:56 ` Tejun Heo
2023-11-28 18:32 ` Waiman Long
2023-11-28 22:12 ` Tejun Heo
2023-11-29 16:01 ` Waiman Long [this message]
2023-12-01 17:06 ` Tejun Heo
2023-12-05 22:16 ` 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=b6f88157-cf5e-4c7b-99f3-1944b4e7ebde@redhat.com \
--to=longman@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=browsell@redhat.com \
--cc=cgroups@vger.kernel.org \
--cc=frederic@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=mhocko@suse.com \
--cc=mpatel@redhat.com \
--cc=pehunt@redhat.com \
--cc=rphillips@redhat.com \
--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
all inboxes | Powered by JetHome®