lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7a7bc23f-be01-d06a-42d2-a2a121577b09@redhat.com>
Date:   Wed, 4 Oct 2023 08:19:58 -0400
From:   Waiman Long <longman@...hat.com>
To:     Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>
Cc:     Ingo Molnar <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Valentin Schneider <vschneid@...hat.com>,
        linux-kernel@...r.kernel.org, Phil Auld <pauld@...hat.com>,
        Brent Rowsell <browsell@...hat.com>,
        Peter Hunt <pehunt@...hat.com>,
        Florian Weimer <fweimer@...hat.com>
Subject: Re: [PATCH v4] sched/core: Use zero length to reset cpumasks in
 sched_setaffinity()

On 10/4/23 06:06, Ingo Molnar wrote:
> * Peter Zijlstra <peterz@...radead.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ