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, 10 Jun 2024 15:06:04 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Usama Arif <usamaarif642@...il.com>
Cc: akpm@...ux-foundation.org, hannes@...xchg.org, david@...hat.com,
	ying.huang@...el.com, hughd@...gle.com, yosryahmed@...gle.com,
	nphamcs@...il.com, chengming.zhou@...ux.dev, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH v3 1/2] mm: store zero pages to be swapped out in a bitmap

On Mon, Jun 10, 2024 at 02:56:09PM +0100, Usama Arif wrote:
> I am guessing what you are suggesting is just do this?
> 
>     if (is_folio_zero_filled(folio)) {
>         swap_zeromap_folio_set(folio);
>         folio_unlock(folio);
>         return 0;
>     }

Right.

> This is what I did initially while developing this, but when I started
> looking into why zswap_store does  folio_start_writeback, folio_unlock,
> folio_end_writeback I found:
> 
> https://elixir.bootlin.com/linux/v6.9.3/source/Documentation/filesystems/locking.rst#L336
> 
> "If no I/O is submitted, the filesystem must run end_page_writeback()
> against the page before returning from writepage."

But that's advice to filesystem authors.  File pages don't come this
way; we only put anonyous pages into swap (except tmpfs).

> If we have zswap enabled, the zero filled pages (infact any page that is
> compressed), will be saved in zswap_entry and NR_WRITTEN will be wrongly
> incremented. So the behaviour for NR_WRITTEN does not change in this patch
> when encountering zero pages with zswap enabled (even if its wrong).

We should fiz zswap too.

> In order to fix NR_WRITTEN accounting for zswap, this patch series and any
> other cases where no I/O is submitted but end_page_writeback is called
> before returning to writepage, maybe we could add an argument to
> __folio_end_writeback like below? There are a lot of calls to
> folio_end_writeback and the behaviour of zeropage with regards to NR_WRITTEN
> doesnt change with or without this patchseries with zswap enabled, so maybe
> we could keep this independent of this series? I would be happy to submit
> this as separate patch if it makes sense.

It makes no sense at all.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ