2017-11-02 15:10:08

by Srividya Desireddy

[permalink] [raw]
Subject: Re: [PATCH] zswap: Same-filled pages handling


On Wed, Oct 19, 2017 at 6:38 AM, Matthew Wilcox wrote:
> On Thu, Oct 19, 2017 at 12:31:18AM +0300, Timofey Titovets 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;
>> > + }
>> > +}
>>
>> Same here, but with memcpy().
>
>No. Use memset_l which is optimised for this specific job.

I have tested this patch using memset_l() function in zswap_fill_page() on
x86 64-bit system with 2GB RAM. The performance remains same.
But, memset_l() funcion might be optimised in future.
@Seth Jennings/Dan Streetman: Should I use memset_l() function in this patch.

From 1581697938815558360@xxx Thu Oct 19 14:51:40 +0000 2017
X-GM-THRID: 1581603008024215631
X-Gmail-Labels: Inbox,Category Forums