linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Ingo Molnar <mingo@kernel.org>, Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Valentin Schneider <vschneid@redhat.com>,
	linux-kernel@vger.kernel.org, Phil Auld <pauld@redhat.com>,
	Brent Rowsell <browsell@redhat.com>,
	Peter Hunt <pehunt@redhat.com>,
	Florian Weimer <fweimer@redhat.com>
Subject: Re: [PATCH v4] sched/core: Use zero length to reset cpumasks in sched_setaffinity()
Date: Wed, 4 Oct 2023 08:19:58 -0400	[thread overview]
Message-ID: <7a7bc23f-be01-d06a-42d2-a2a121577b09@redhat.com> (raw)
In-Reply-To: <ZR05JXPgOXb4kuHl@gmail.com>

On 10/4/23 06:06, Ingo Molnar wrote:
> * Peter Zijlstra <peterz@infradead.org> wrote:
>
>> On Wed, Oct 04, 2023 at 11:23:41AM +0200, Ingo Molnar wrote:
>>
>>>>   	if (user_mask) {
>>>> -		cpumask_copy(user_mask, in_mask);
>>>> +		/*
>>>> +		 * All-set user cpumask resets affinity and drops the explicit
>>>> +		 * user mask.
>>>> +		 */
>>>> +		cpumask_and(user_mask, in_mask, cpu_possible_mask);
>>>> +		if (cpumask_equal(user_mask, cpu_possible_mask)) {
>>>> +			kfree(user_mask);
>>>> +			user_mask = NULL;
>>>> +		}
>>> Question: is there any observable behavioral difference between current
>>> (old) all-set cpumask calls and the patched (new) one?
>> Very little I think -- the main difference is that we no longer carry
>> the ->user_cpus_ptr mask around, and that saves a little masking.
> So calling with a full mask would actually work fine on 'old' kernels too,
> as it's a 'reset' event in essence. (With a bit of allocation & masking
> overhead.)
>
> This pretty unambiguously marks the full-mask solution as the superior ABI ...

I am fine with that one too. I do have a little bit concern about that 
the difference in behavior when the full mask is passed in, but that is 
reverting to the old behavior before commit 8f9ea86fdf99 ("sched: Always 
preserve the user requested cpumask").

BTW, we can probably check the in_mask directly earlier to skip an 
unnecessary cpumask allocation and free in this particular case.

Cheers,
Longman


  reply	other threads:[~2023-10-04 12:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 20:57 [PATCH v4] sched/core: Use zero length to reset cpumasks in sched_setaffinity() Waiman Long
2023-10-04  8:36 ` Peter Zijlstra
2023-10-04  9:23   ` Ingo Molnar
2023-10-04  9:43     ` Peter Zijlstra
2023-10-04 10:06       ` Ingo Molnar
2023-10-04 12:19         ` Waiman Long [this message]
2023-10-04 12:34   ` Florian Weimer
2023-10-04 12:41     ` Waiman Long
2023-10-04 12:55       ` Florian Weimer
2023-10-04 16:23         ` Waiman Long
2023-10-04 13:52     ` Peter Zijlstra
2023-10-04 13:54       ` Peter Zijlstra

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=7a7bc23f-be01-d06a-42d2-a2a121577b09@redhat.com \
    --to=longman@redhat.com \
    --cc=bristot@redhat.com \
    --cc=browsell@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=fweimer@redhat.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=pauld@redhat.com \
    --cc=pehunt@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@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 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).