From: Tejun Heo <tj@kernel.org>
To: Waiman Long <longman@redhat.com>
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: Fri, 1 Dec 2023 07:06:53 -1000 [thread overview]
Message-ID: <ZWoSrfztmprcdkpO@slm.duckdns.org> (raw)
In-Reply-To: <b6f88157-cf5e-4c7b-99f3-1944b4e7ebde@redhat.com>
Hello,
On Wed, Nov 29, 2023 at 11:01:04AM -0500, Waiman Long wrote:
...
> > > 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
Setting and clearing a bit is as atomic as it gets, right?
> 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 just can't think of a case where this would be broken. The data being read
and written is atomic. There's no way to break a bit operation into multiple
pieces. It is possible to write a really bone-headed bitmask operations
(like, if you shift the bits into place or sth) to make the bits go through
unintended changes but that'd just be a flat-out broken implementation. Even
for a bitmask where write accesses are synchronized through a spinlock, we
should still be able to use test_bit() without holding the lock. This seems
like a pretty basic assumption.
Adding unnecessary synchronization confuses the readers. If we don't need
it, we shouldn't have it.
Thanks.
--
tejun
next prev parent reply other threads:[~2023-12-01 17:06 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
2023-12-01 17:06 ` Tejun Heo [this message]
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=ZWoSrfztmprcdkpO@slm.duckdns.org \
--to=tj@kernel.org \
--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=longman@redhat.com \
--cc=mhocko@suse.com \
--cc=mpatel@redhat.com \
--cc=pehunt@redhat.com \
--cc=rphillips@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.