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: <87r0ge3oey.fsf@yhuang6-desk2.ccr.corp.intel.com>
Date: Wed, 13 Mar 2024 09:34:29 +0800
From: "Huang, Ying" <ying.huang@...el.com>
To: Ryan Roberts <ryan.roberts@....com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,  David Hildenbrand
 <david@...hat.com>,  Matthew Wilcox <willy@...radead.org>,  Gao Xiang
 <xiang@...nel.org>,  Yu Zhao <yuzhao@...gle.com>,  Yang Shi
 <shy828301@...il.com>,  Michal Hocko <mhocko@...e.com>,  Kefeng Wang
 <wangkefeng.wang@...wei.com>,  Barry Song <21cnbao@...il.com>,  Chris Li
 <chrisl@...nel.org>,  <linux-mm@...ck.org>,
  <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 3/6] mm: swap: Simplify struct percpu_cluster

Ryan Roberts <ryan.roberts@....com> writes:

> On 12/03/2024 07:52, Huang, Ying wrote:
>> Ryan Roberts <ryan.roberts@....com> writes:
>> 
>>> struct percpu_cluster stores the index of cpu's current cluster and the
>>> offset of the next entry that will be allocated for the cpu. These two
>>> pieces of information are redundant because the cluster index is just
>>> (offset / SWAPFILE_CLUSTER). The only reason for explicitly keeping the
>>> cluster index is because the structure used for it also has a flag to
>>> indicate "no cluster". However this data structure also contains a spin
>>> lock, which is never used in this context, as a side effect the code
>>> copies the spinlock_t structure, which is questionable coding practice
>>> in my view.
>>>
>>> So let's clean this up and store only the next offset, and use a
>>> sentinal value (SWAP_NEXT_INVALID) to indicate "no cluster".
>>> SWAP_NEXT_INVALID is chosen to be 0, because 0 will never be seen
>>> legitimately; The first page in the swap file is the swap header, which
>>> is always marked bad to prevent it from being allocated as an entry.
>>> This also prevents the cluster to which it belongs being marked free, so
>>> it will never appear on the free list.
>>>
>>> This change saves 16 bytes per cpu. And given we are shortly going to
>>> extend this mechanism to be per-cpu-AND-per-order, we will end up saving
>>> 16 * 9 = 144 bytes per cpu, which adds up if you have 256 cpus in the
>>> system.
>>>
>>> Signed-off-by: Ryan Roberts <ryan.roberts@....com>
>> 
>> LGTM, Thanks!
>
> Thanks! What's a guy got to do to get Rb or Ack? :)

Feel free to add

Reviewed-by: "Huang, Ying" <ying.huang@...el.com>

in the future version.

--
Best Regards,
Huang, Ying

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ