[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171018144350epcms5p1f390fae66f1c9440b8552acec555ca01@epcms5p1>
Date: Wed, 18 Oct 2017 14:43:50 +0000
From: Srividya Desireddy <srividya.dr@...sung.com>
To: Matthew Wilcox <willy@...radead.org>,
Timofey Titovets <nefelim4ag@...il.com>
CC: "sjenning@...hat.com" <sjenning@...hat.com>,
"ddstreet@...e.org" <ddstreet@...e.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"penberg@...nel.org" <penberg@...nel.org>,
Dinakar Reddy Pathireddy <dinakar.p@...sung.com>,
SHARAN ALLUR <sharan.allur@...sung.com>,
RAJIB BASU <rajib.basu@...sung.com>,
JUHUN KIM <juhunkim@...sung.com>,
"srividya.desireddy@...il.com" <srividya.desireddy@...il.com>
Subject: Re: [PATCH] zswap: Same-filled pages handling
On Wed, Oct 18, 2017 at 7:41 PM, Matthew Wilcox wrote:
> On Wed, Oct 18, 2017 at 04:33:43PM +0300, Timofey Titovets wrote:
>> 2017-10-18 15:34 GMT+03:00 Matthew Wilcox <willy@...radead.org>:
>> > On Wed, Oct 18, 2017 at 10:48:32AM +0000, Srividya Desireddy wrote:
>> >> +static void zswap_fill_page(void *ptr, unsigned long value)
>> >> +{
>> >> + unsigned int pos;
>> >> + unsigned long *page;
>> >> +
>> >> + page = (unsigned long *)ptr;
>> >> + if (value == 0)
>> >> + memset(page, 0, PAGE_SIZE);
>> >> + else {
>> >> + for (pos = 0; pos < PAGE_SIZE / sizeof(*page); pos++)
>> >> + page[pos] = value;
>> >> + }
>> >> +}
>> >
>> > I think you meant:
>> >
>> > static void zswap_fill_page(void *ptr, unsigned long value)
>> > {
>> > memset_l(ptr, value, PAGE_SIZE / sizeof(unsigned long));
>> > }
>>
>> IIRC kernel have special zero page, and if i understand correctly.
>> You can map all zero pages to that zero page and not touch zswap completely.
>> (Your situation look like some KSM case (i.e. KSM can handle pages
>> with same content), but i'm not sure if that applicable there)
>
>You're confused by the word "same". What Srividya meant was that the
>page is filled with a pattern, eg 0xfffefffefffefffe..., not that it is
>the same as any other page.
In kernel there is a special zero page or empty_zero_page which is in
general allocated in paging_init() function, to map all zero pages. But,
same-value-filled pages including zero pages exist in memory because
applications may be initializing the allocated pages with a value and not
using them; or the actual content written to the memory pages during
execution itself is same-value, in case of multimedia data for example.
I had earlier posted a patch with similar implementaion of KSM concept
for Zswap:
https://lkml.org/lkml/2016/8/17/171
https://lkml.org/lkml/2017/2/17/612
- Srividya
Powered by blists - more mailing lists