linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mm: clear pte for folios that are zero filled
@ 2024-06-04 10:58 Usama Arif
  2024-06-04 10:58 ` [PATCH v2 1/2] " Usama Arif
  2024-06-04 10:58 ` [PATCH v2 2/2] mm: remove code to handle same filled pages Usama Arif
  0 siblings, 2 replies; 11+ messages in thread
From: Usama Arif @ 2024-06-04 10:58 UTC (permalink / raw)
  To: akpm
  Cc: hannes, willy, yosryahmed, nphamcs, chengming.zhou, linux-mm,
	linux-kernel, kernel-team, Usama Arif

As shown in the patchseries that introduced the zswap same-filled
optimization [1], 10-20% of the pages stored in zswap are same-filled.
This is also observed across Meta's server fleet.
By using VM counters in swap_writepage (not included in this
patchseries) it was found that less than 1% of the same-filled
pages to be swapped out are non-zero pages.

For conventional swap setup (without zswap), rather than reading/writing
these pages to flash resulting in increased I/O and flash wear, the pte
can be cleared for those addresses at unmap time while shrinking folio
list. When this causes a page fault, do_pte_missing will take care of this
page.

When using zswap, this also means that a zswap_entry does not
need to be allocated for zero filled pages resulting in memory savings.

A similar attempt was made earlier in [2] where zswap would only track
zero-filled pages instead of same-filled.
This patchseries adds zero-filled pages optimization by default
(hence it can be used even if zswap is disabled) and removes the
same-filled code from zswap (as only 1% of the same-filled pages are
non-zero), simplifying code.

This patchseries is based on mm-unstable.

[1] https://lore.kernel.org/all/20171018104832epcms5p1b2232e2236258de3d03d1344dde9fce0@epcms5p1/
[2] https://lore.kernel.org/lkml/20240325235018.2028408-1-yosryahmed@google.com/

---
v1 -> v2:
- instead of using a bitmap in swap, clear pte for zero pages and let
  do_pte_missing handle this page at page fault. (Yosry and Matthew)
- Check end of page first when checking if folio is zero filled as
  it could lead to better performance. (Yosry)

Usama Arif (2):
  mm: clear pte for folios that are zero filled
  mm: remove code to handle same filled pages

 include/linux/rmap.h |   1 +
 mm/rmap.c            | 163 ++++++++++++++++++++++---------------------
 mm/vmscan.c          |  89 ++++++++++++++++-------
 mm/zswap.c           |  86 +++--------------------
 4 files changed, 158 insertions(+), 181 deletions(-)

-- 
2.43.0



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-06-07 11:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-04 10:58 [PATCH v2 0/2] mm: clear pte for folios that are zero filled Usama Arif
2024-06-04 10:58 ` [PATCH v2 1/2] " Usama Arif
2024-06-04 12:18   ` Matthew Wilcox
2024-06-04 12:42     ` Usama Arif
2024-06-04 12:30   ` David Hildenbrand
2024-06-04 12:43     ` David Hildenbrand
2024-06-07 10:24       ` Usama Arif
2024-06-07 11:16         ` David Hildenbrand
2024-06-05  8:55   ` Shakeel Butt
2024-06-07 10:40     ` Usama Arif
2024-06-04 10:58 ` [PATCH v2 2/2] mm: remove code to handle same filled pages Usama Arif

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox