linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Usama Arif <usamaarif642@gmail.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	akpm@linux-foundation.org
Cc: hannes@cmpxchg.org, shakeel.butt@linux.dev, david@redhat.com,
	ying.huang@intel.com, hughd@google.com, willy@infradead.org,
	yosryahmed@google.com, nphamcs@gmail.com,
	chengming.zhou@linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, kernel-team@meta.com,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [RESEND v8 1/2] mm: store zero pages to be swapped out in a bitmap
Date: Sat, 24 Aug 2024 14:58:47 -0400	[thread overview]
Message-ID: <f4b5fefb-d5cb-4b21-845f-1c5a2165990d@gmail.com> (raw)
In-Reply-To: <70a3d71d-b0f9-48b8-bb00-497cd17da764@wanadoo.fr>



On 24/08/2024 02:55, Christophe JAILLET wrote:
> Le 23/08/2024 à 21:04, Usama Arif a écrit :
>> 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).
>>
>> [1] https://lore.kernel.org/all/20171018104832epcms5p1b2232e2236258de3d03d1344dde9fce0@epcms5p1/
>>
> 
> ...
> 
>> @@ -3428,6 +3444,17 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
>>           goto bad_swap_unlock_inode;
>>       }
>>   +    /*
>> +     * Use kvmalloc_array instead of bitmap_zalloc as the allocation order might
>> +     * be above MAX_PAGE_ORDER incase of a large swap file.
>> +     */
>> +    zeromap = kvmalloc_array(BITS_TO_LONGS(maxpages), sizeof(long),
>> +                    GFP_KERNEL | __GFP_ZERO);
> 
> Nitpick: kvcalloc() maybe, to be slightly less verbose?
> 

There was quite a long discussion [1] on this in v5 of the series, and we settled no kvmalloc_array in the end. I think best to leave it as it is at kvmalloc_array.

Thanks

[1] https://lore.kernel.org/all/159061bc-27b5-4127-a85d-223bed0ddfd5@gmail.com/



  reply	other threads:[~2024-08-24 18:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-23 19:04 [RESEND v8 0/2] " Usama Arif
2024-08-23 19:04 ` [RESEND v8 1/2] " Usama Arif
2024-08-24  6:55   ` Christophe JAILLET
2024-08-24 18:58     ` Usama Arif [this message]
2024-08-23 19:04 ` [RESEND v8 2/2] mm: remove code to handle same filled pages Usama Arif
2024-08-24  5:06 ` [RESEND v8 0/2] mm: store zero pages to be swapped out in a bitmap Andrew Morton
2024-08-24 18:47   ` Usama Arif

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f4b5fefb-d5cb-4b21-845f-1c5a2165990d@gmail.com \
    --to=usamaarif642@gmail.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=shakeel.butt@linux.dev \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    --cc=yosryahmed@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox