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]
Date: Mon, 1 Jan 2024 11:26:57 -0500
From: Waiman Long <longman@...hat.com>
To: Markus Elfring <Markus.Elfring@....de>, cgroups@...r.kernel.org,
 kernel-janitors@...r.kernel.org, Johannes Weiner <hannes@...xchg.org>,
 Tejun Heo <tj@...nel.org>, Zefan Li <lizefan.x@...edance.com>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] cgroup/cpuset: Adjust exception handling in
 generate_sched_domains()

On 1/1/24 03:56, Markus Elfring wrote:
>>> Two resource allocation failures triggered further actions
>>> over the label “done” so far.
>>>
>>> * Jump to the statement “ndoms = 1;” in three cases directly
>>>     by using the label “set_ndoms” instead.
>>>
>>> * Delete an assignment for the variable “ndoms” in one if branch.
> …
>>> ---
>>>    kernel/cgroup/cpuset.c | 8 ++++----
>>>    1 file changed, 4 insertions(+), 4 deletions(-)
> …
>>> @@ -973,10 +973,9 @@ static int generate_sched_domains(cpumask_var_t **domains,
>>>
>>>        /* Special case for the 99% of systems with one, full, sched domain */
>>>        if (root_load_balance && !top_cpuset.nr_subparts) {
>>> -        ndoms = 1;
>>>            doms = alloc_sched_domains(ndoms);
>>>            if (!doms)
>>> -            goto done;
>>> +            goto set_ndoms;
>>>
>>>            dattr = kmalloc(sizeof(struct sched_domain_attr), GFP_KERNEL);
>>>            if (dattr) {
> …
>>> @@ -1123,6 +1122,7 @@ static int generate_sched_domains(cpumask_var_t **domains,
>>>         * See comments in partition_sched_domains().
>>>         */
>>>        if (doms == NULL)
>>> +set_ndoms:
>>>            ndoms = 1;
>>>
>>>        *domains    = doms;
> …
>> Please clarify what this patch is for. Is it just a cleanup with no functional changes or is there a bug that is being fixed?
> The development opinions might vary for the presented transformation.
> I suggest to reconsider the number of relevant variable assignments here.
> Would you categorise an extra statement still as a desirable implementation detail?

My understanding of the patch is just to avoid an unnecessary call to 
kfree() as kfree(NULL) is basically a NOP. By jumping inside the "if" 
part of the conditional statement, however, it makes it a bit harder to 
read. As generate_sched_domains() is not in the fast path, I would 
rather have a patch that can simplify the logic than to make it harder 
to understand.

Cheers,
Longman


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ