[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240530125833.fd5315f80316436e93f91dfb@linux-foundation.org>
Date: Thu, 30 May 2024 12:58:33 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Usama Arif <usamaarif642@...il.com>
Cc: hannes@...xchg.org, 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 1/2] mm: store zero pages to be swapped out in a bitmap
On Thu, 30 May 2024 11:19:07 +0100 Usama Arif <usamaarif642@...il.com> wrote:
> Approximately 10-20% of pages to be swapped out are zero pages [1].
> Rather than reading/writing these pages to flash resulting
> in increased I/O and flash wear, a bitmap can be used to mark these
> pages as zero at write time, and the pages can be filled at
> read time if the bit corresponding to the page is set.
> With this patch, NVMe writes in Meta server fleet decreased
> by almost 10% with conventional swap setup (zswap disabled).
A little nitlet as you'll be altering the code...
> --- a/mm/page_io.c
> +++ b/mm/page_io.c
> @@ -172,6 +172,77 @@ int generic_swapfile_activate(struct swap_info_struct *sis,
> goto out;
> }
>
> +static bool is_folio_page_zero_filled(struct folio *folio, int i)
> +{
> + unsigned long *page;
> + unsigned int pos;
> + bool ret = false;
> +
> + page = kmap_local_folio(folio, i * PAGE_SIZE);
It's rather expected that a local variable called `page' has type
`struct page *'. Can we use something like `addr' here?
> + for (pos = 0; pos < PAGE_SIZE / sizeof(*page); pos++) {
> + if (page[pos] != 0)
> + goto out;
> + }
> + ret = true;
> +out:
> + kunmap_local(page);
> + return ret;
> +}
Powered by blists - more mailing lists