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:   Fri, 18 Sep 2020 11:18:31 -0400
From:   Waiman Long <longman@...hat.com>
To:     "Xu, Yanfei" <yanfei.xu@...driver.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        Michel Lespinasse <walken@...gle.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] sched, mm: Optimize current_gfp_context()

On 9/18/20 2:44 AM, Xu, Yanfei wrote:
> Hi Waiman,
>
> On 8/12/20 6:29 AM, Andrew Morton wrote:
>> On Thu, 18 Jun 2020 17:29:36 -0400 Waiman Long <longman@...hat.com> 
>> wrote:
>>
>>> The current_gfp_context() converts a number of PF_MEMALLOC_* 
>>> per-process
>>> flags into the corresponding GFP_* flags for memory allocation. In
>>> that function, current->flags is accessed 3 times. That may lead to
>>> duplicated access of the same memory location.
>>>
> I have a puzzle about this comment, what's the meaning about "That may
> lead to duplicated access of the same memory location". After using
> variable 'pflags', will it not duplicated access the same memory
> location?
> Looking forward to your reply :)

That condition usually won't happen on a non-debug kernel. However, if 
certain debugging capability is turned on, access to current will be 
compiled into a bunch of checks and memory accesses. So if current is 
used multiple times, the same set of codes will be duplicated the same 
number of times slowing down the operation and increasing code size. By 
accessing current once, we avoid this overhead in a debug kernel.

Cheers,
Longman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ