From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8E6B42121C109 for ; Fri, 3 May 2019 00:31:31 -0700 (PDT) Date: Fri, 3 May 2019 09:31:26 +0200 From: Oscar Salvador Subject: Re: [PATCH v7 03/12] mm/sparsemem: Add helpers track active portions of a section at boot Message-ID: <20190503073121.GA15740@linux> References: <155677652226.2336373.8700273400832001094.stgit@dwillia2-desk3.amr.corp.intel.com> <155677653785.2336373.11131100812252340469.stgit@dwillia2-desk3.amr.corp.intel.com> <20190502074803.GA3495@linux> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" To: Dan Williams Cc: Michal Hocko , linux-nvdimm , Linux Kernel Mailing List , Linux MM , Andrew Morton , Vlastimil Babka List-ID: On Thu, May 02, 2019 at 07:03:45AM -0700, Dan Williams wrote: > > section_active_mask() also converts the value to address/size. > > Why do we need to convert the values and we cannot work with pfn/pages instead? > > It should be perfectly possible unless I am missing something. > > > > The only thing required would be to export earlier your: > > > > +#define PAGES_PER_SUB_SECTION (SECTION_ACTIVE_SIZE / PAGE_SIZE) > > +#define PAGE_SUB_SECTION_MASK (~(PAGES_PER_SUB_SECTION-1)) > > > > and change section_active_index to: > > > > static inline int section_active_index(unsigned long pfn) > > { > > return (pfn & ~(PAGE_SECTION_MASK)) / SUB_SECTION_ACTIVE_PAGES; Sorry, here I meant: return (pfn & ~(PAGE_SECTION_MASK)) / PAGES_PER_SUB_SECTION; But I think you got the idea :-) -- Oscar Salvador SUSE L3 _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BFA7C43219 for ; Fri, 3 May 2019 07:31:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3F0C120B7C for ; Fri, 3 May 2019 07:31:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726438AbfECHbb (ORCPT ); Fri, 3 May 2019 03:31:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:52498 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725768AbfECHbb (ORCPT ); Fri, 3 May 2019 03:31:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C5BB9AEA1; Fri, 3 May 2019 07:31:29 +0000 (UTC) Date: Fri, 3 May 2019 09:31:26 +0200 From: Oscar Salvador To: Dan Williams Cc: Andrew Morton , Michal Hocko , Vlastimil Babka , Logan Gunthorpe , Jane Chu , linux-nvdimm , Linux MM , Linux Kernel Mailing List Subject: Re: [PATCH v7 03/12] mm/sparsemem: Add helpers track active portions of a section at boot Message-ID: <20190503073121.GA15740@linux> References: <155677652226.2336373.8700273400832001094.stgit@dwillia2-desk3.amr.corp.intel.com> <155677653785.2336373.11131100812252340469.stgit@dwillia2-desk3.amr.corp.intel.com> <20190502074803.GA3495@linux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 02, 2019 at 07:03:45AM -0700, Dan Williams wrote: > > section_active_mask() also converts the value to address/size. > > Why do we need to convert the values and we cannot work with pfn/pages instead? > > It should be perfectly possible unless I am missing something. > > > > The only thing required would be to export earlier your: > > > > +#define PAGES_PER_SUB_SECTION (SECTION_ACTIVE_SIZE / PAGE_SIZE) > > +#define PAGE_SUB_SECTION_MASK (~(PAGES_PER_SUB_SECTION-1)) > > > > and change section_active_index to: > > > > static inline int section_active_index(unsigned long pfn) > > { > > return (pfn & ~(PAGE_SECTION_MASK)) / SUB_SECTION_ACTIVE_PAGES; Sorry, here I meant: return (pfn & ~(PAGE_SECTION_MASK)) / PAGES_PER_SUB_SECTION; But I think you got the idea :-) -- Oscar Salvador SUSE L3