From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752022AbdJROLV (ORCPT ); Wed, 18 Oct 2017 10:11:21 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:46392 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750942AbdJROLT (ORCPT ); Wed, 18 Oct 2017 10:11:19 -0400 Date: Wed, 18 Oct 2017 07:11:16 -0700 From: Matthew Wilcox To: Timofey Titovets Cc: Srividya Desireddy , "sjenning@redhat.com" , "ddstreet@ieee.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "penberg@kernel.org" , Dinakar Reddy Pathireddy , SHARAN ALLUR , RAJIB BASU , JUHUN KIM , "srividya.desireddy@gmail.com" Subject: Re: [PATCH] zswap: Same-filled pages handling Message-ID: <20171018141116.GA12063@bombadil.infradead.org> References: <20171018104832epcms5p1b2232e2236258de3d03d1344dde9fce0@epcms5p1> <20171018123427.GA7271@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 18, 2017 at 04:33:43PM +0300, Timofey Titovets wrote: > 2017-10-18 15:34 GMT+03:00 Matthew Wilcox : > > 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. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f69.google.com (mail-pg0-f69.google.com [74.125.83.69]) by kanga.kvack.org (Postfix) with ESMTP id F3EDB6B0069 for ; Wed, 18 Oct 2017 10:11:19 -0400 (EDT) Received: by mail-pg0-f69.google.com with SMTP id k7so4179275pga.8 for ; Wed, 18 Oct 2017 07:11:19 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id w12si2975151pld.307.2017.10.18.07.11.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Oct 2017 07:11:18 -0700 (PDT) Date: Wed, 18 Oct 2017 07:11:16 -0700 From: Matthew Wilcox Subject: Re: [PATCH] zswap: Same-filled pages handling Message-ID: <20171018141116.GA12063@bombadil.infradead.org> References: <20171018104832epcms5p1b2232e2236258de3d03d1344dde9fce0@epcms5p1> <20171018123427.GA7271@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Timofey Titovets Cc: Srividya Desireddy , "sjenning@redhat.com" , "ddstreet@ieee.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "penberg@kernel.org" , Dinakar Reddy Pathireddy , SHARAN ALLUR , RAJIB BASU , JUHUN KIM , "srividya.desireddy@gmail.com" On Wed, Oct 18, 2017 at 04:33:43PM +0300, Timofey Titovets wrote: > 2017-10-18 15:34 GMT+03:00 Matthew Wilcox : > > 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. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org