lkml.org 
[lkml]   [2020]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH 4/4] mm: Add PG_zero support
From
Date
On 4/12/2020 3:12 AM, Matthew Wilcox wrote:
> On Sun, Apr 12, 2020 at 05:09:49AM -0400, liliangleo wrote:
>> Zero out the page content usually happens when allocating pages,
>> this is a time consuming operation, it makes pin and mlock
>> operation very slowly, especially for a large batch of memory.
>>
>> This patch introduce a new feature for zero out pages before page
>> allocation, it can help to speed up page allocation.
>>
>> The idea is very simple, zero out free pages when the system is
>> not busy and mark the page with PG_zero, when allocating a page,
>> if the page need to be filled with zero, check the flag in the
>> struct page, if it's marked as PG_zero, zero out can be skipped,
>> it can save cpu time and speed up page allocation.
>
> We are very short on bits in the page flags. If we can implement this
> feature without using another one, this would be good.
>
> If the bit is only set on pages which are PageBuddy(), we can definitely
> find space for it as an alias of another bit.


I had considered doing something similar several months back because one
of the side effects in the VM is that most of the pages appear to have
been zeroed by page reporting. However the problem is that in order to
handle the zeroing case you have to push the flag outside the PageBuddy
region, and you cannot guarantee that the page is even expected to be
zeroed since it might have been zeroed before it was freed, so it is
just adding work of having to clear an extra flag some time after
allocation.

In addition, unlike madvising the page away there is a pretty
significant performance penalty for having to clear the page a second
time when the page is split or merged.

\
 
 \ /
  Last update: 2020-04-13 17:12    [W:0.083 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site