mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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: Tue, 28 Nov 2023 13:32:53 -0500	[thread overview]
Message-ID: <8de482b5-1942-4312-8de4-6f54565ab517@redhat.com> (raw)
In-Reply-To: <ZWYbqNnnt6gQOssK@slm.duckdns.org>


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 why I am adding some synchronization primitive to prevent 
racing. My original plan was to take the callback_lock. However, that 
can be somewhat costly if this API is used rather frequently, especially 
on systems with large # of CPUs. So I change it to use seqcount for read 
protection which has a much lower cost.

Regarding patch 1 on converting callback_lock to raw_spinlock_t, I can 
drop it if you have concern about that change. I just need to surround 
the write_seqcount_begin()/write_seqcount_end() calls with 
preempt_disabled()/preempt_enabled().

Cheers,
Longman


  reply	other threads:[~2023-11-28 18:33 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 [this message]
2023-11-28 22:12       ` Tejun Heo
2023-11-29 16:01         ` Waiman Long
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=8de482b5-1942-4312-8de4-6f54565ab517@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®