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=-10.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT 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 D00F6C0044C for ; Wed, 7 Nov 2018 17:39:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A40E620862 for ; Wed, 7 Nov 2018 17:39:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Rc6J1ipf"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ZUNsoz+9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A40E620862 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=deltatee.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lcE8RRb5xarHK+1H9V/jn/G1hXN7lPiv1zooM+r7nuE=; b=Rc6J1ipfSQuzQn ZIjMNAJnD3OVTgqk1u5TUQwEaMRW6RJN9GM52icuZ5pUk1FUBKq5pXYlPFBYs5ugXWWImKM2zul2K kq1qdTXcSDvpU2KHCOQ9b7Z60r6gc0wgfb7VF0U1k4u0W0zP50TQWKRtaO5zjS3Jg2eFZlotLnKcO P0bH+2NIVAOgUshQbVr/q2sCglCyM0JAQGGqt1qIzjgPf3xL9chvFl+ywifNRyd3+djZVF5XNDr4a XmmLVh3ZeKYg+LEr8seXRXu5lGfO2wPaELbZ9utooTT8wQ9iPChMRyqcbSZg2yRmcQ1mNFSfcTWW5 Ux58jd4DHTI5iJayye0g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKRnZ-0000IK-HC; Wed, 07 Nov 2018 17:39:25 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKRnY-0000Hs-4m; Wed, 07 Nov 2018 17:39:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Subject:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=SUpvKtrKWj0LEBMJVxJ8Fc9aERslhBdlht6Yi3t4nSs=; b=ZUNsoz+9d6ZxuIsSiYeFe3Zfab Q5t+7qYXnzjT+/NLeacKfHQm1bFOu2k3Dc8ceD56HEZC4aRWGDHlfRM/9IiAx+hZGQ/+bO9PTSvr+ uiEZxkIIlcAneabD9v6aP5Tj8NJ6KyyigUbAXoXMcqmmxO4M73PmFVm7MIUWyNW62UXq/gM8LCPaZ Yb/ynaoE2ihb1Djo7B4xVC9wFw9fHEWpP31/WfiC2z8r9Yy3ckG07mGog2a3sx+4IAXqV62FLcxor 7KvNgD07QChAy87lM4lfkqIH+//y027Mh5xMw/j83JW5PnClCvpMcrmxH49ryOSsoqR8PKsL//cDY p0AwP20A==; Received: from ale.deltatee.com ([207.54.116.67]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKRnU-0008Jr-KG; Wed, 07 Nov 2018 17:39:22 +0000 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gKRnC-0003U6-6F; Wed, 07 Nov 2018 10:39:04 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1gKRnA-0006HT-JA; Wed, 07 Nov 2018 10:39:00 -0700 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-sh@vger.kernel.org, Andrew Morton Date: Wed, 7 Nov 2018 10:38:59 -0700 Message-Id: <20181107173859.24096-3-logang@deltatee.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181107173859.24096-1-logang@deltatee.com> References: <20181107173859.24096-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-sh@vger.kernel.org, akpm@linux-foundation.org, sbates@raithlin.com, palmer@sifive.com, aou@eecs.berkeley.edu, hch@lst.de, arnd@arndb.de, logang@deltatee.com, mhocko@suse.com, vbabka@suse.cz, osalvador@suse.de X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH 2/2] mm/sparse: add common helper to mark all memblocks present X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181107_123921_142529_6D589A11 X-CRM114-Status: GOOD ( 11.93 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Albert Ou , Arnd Bergmann , Palmer Dabbelt , Stephen Bates , Michal Hocko , Logan Gunthorpe , Christoph Hellwig , Vlastimil Babka , Oscar Salvador Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org Message-ID: <20181107173859.LyfuWHh5xKMe1mFc7hFUjBo1o5bmopWKgVoI7SQoSgc@z> Presently the arches arm64, arm and sh have a function which loops through each memblock and calls memory present. riscv will require a similar function. Introduce a common memblocks_present() function that can be used by all the arches. Subsequent patches will cleanup the arches that make use of this. Signed-off-by: Logan Gunthorpe Cc: Andrew Morton Cc: Michal Hocko Cc: Vlastimil Babka Cc: Oscar Salvador --- include/linux/mmzone.h | 6 ++++++ mm/sparse.c | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 847705a6d0ec..db023a92f3a4 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -783,6 +783,12 @@ void memory_present(int nid, unsigned long start, unsigned long end); static inline void memory_present(int nid, unsigned long start, unsigned long end) {} #endif +#if defined(CONFIG_SPARSEMEM) +void memblocks_present(void); +#else +static inline void memblocks_present(void) {} +#endif + #ifdef CONFIG_HAVE_MEMORYLESS_NODES int local_memory_node(int node_id); #else diff --git a/mm/sparse.c b/mm/sparse.c index 33307fc05c4d..5841e4ad6d93 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -239,6 +239,17 @@ void __init memory_present(int nid, unsigned long start, unsigned long end) } } +void __init memblocks_present(void) +{ + struct memblock_region *reg; + + for_each_memblock(memory, reg) { + memory_present(memblock_get_region_node(reg), + memblock_region_memory_base_pfn(reg), + memblock_region_memory_end_pfn(reg)); + } +} + /* * Subtle, we encode the real pfn into the mem_map such that * the identity pfn - section_mem_map will return the actual -- 2.19.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv