[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0c36c117-b44c-89ef-1988-6059c41fad65@redhat.com>
Date: Wed, 4 Oct 2023 12:23:28 -0400
From: Waiman Long <longman@...hat.com>
To: Florian Weimer <fweimer@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
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>
Subject: Re: [PATCH v4] sched/core: Use zero length to reset cpumasks in
sched_setaffinity()
On 10/4/23 08:55, Florian Weimer wrote:
> * Waiman Long:
>
>> On 10/4/23 08:34, Florian Weimer wrote:
>>> * Peter Zijlstra:
>>>
>>>> Subject: sched: Add CPU_FILL()
>>>>
>>>> Add the CPU_FILL() macros to easily create an all-set cpumask.
>>>>
>>>> FreeBSD also provides this macro with this semantic.
>>>>
>>>> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
>>> My main concer is that obtaining the size of the mask, or at least an
>>> approximiation is not exactly easy. If there's an expectation that
>>> applications reset the mask more often than they do today (I don't have
>>> the full context here), then we'd some decent interface to get the
>>> approriate size.
>> I believe the macro just use sizeof(cpu_set_t) as the size of the
>> bitmask. It is the same case as in CPU_ZERO().
> I mean the CPU_FILL_S macro also defined in the patch. Correctly
> written applications should not use CPU_FILL and statically sized CPU
> sets.
Right, that can be a problem. If the input bitmask size is less than
cpumask_size(), CPU_FILL_S() won't work to reset the cpumask. In fact,
it will treat that bitmask just like a regular sched_setaffinity() call
and set it accordingly.
With that caveat, I would prefer to keep using a length of 0 for the
reset then.
Cheers,
Longman
Powered by blists - more mailing lists