Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5534223pxb; Wed, 26 Jan 2022 14:22:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/fLeLo8Z9sGShw9UxctW9acdXU1xfvGjvlk1tzwCIj9ll+3p4MS4qYlpWju5ouReuB2w4 X-Received: by 2002:a05:6402:2805:: with SMTP id h5mr967241ede.231.1643235728677; Wed, 26 Jan 2022 14:22:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643235728; cv=none; d=google.com; s=arc-20160816; b=Z5TLyZz2sgh/AS309TnxRwikHUYYHcMPwJUBwYcWE4CoJ4DhnZO9t0YCW1KbG/ipgM nUjNxIf16RmILRmZSZK4Nj7vdWp37cpsWqVz9SHZM59DniEWMOsJyZPIY66qBplic/Da op1KQMRgy617Te0dD5GnGpPJA9qSwB7O9xdQxU/zoVDTE/XqrysGQWq4TW4t3+sUMJ3b QHQUjRFBUjvziWCz3B5fD6IjddUfq+dEHvDbFt3V888UmcbOsrAA+4TPq3QVRClb5/un 4IjKqBxdv5ZJuFRJbDUlhu+yi06zVN+JhAYa8On7+cEyHR2bSMJUb8rOsHcVU5KWXUQ6 ARdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=ZLHyK20O5fjF8tpaoo4j4wWZ9TVY0iYMrpJ/AYsNoaQ=; b=e1SYxUyOntBM6H42IpXcPb8ykQTT0TVhSsi2KPP73T6KMz4fXgXyUgB4H+RK/VrZZG bYdVw0a39xOl0W1922B5hEd0IJ3NGu81fbyB9kvmZzr4xfXmJdWSaI5dHX6BbXbdj4im pSESz5jAyvSGelAzPkEkjfnonK5o0g7sdllz8JgZGlUed8lYMw7GGVTi4vTJ9Aie3eb/ GFXiKedM4K6Jmt3kwJe6lKxtHxTFLvB3TkSfWTkTuqdChix33qrfPWNpThLRTzwZF72f f5/Esp938sk16+6I0wmemuHFRbLqPbjQu6ej1G64R7ipv0eMM/7tX2yFE0XcDOJFIIEH HCYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ajou.ac.kr header.s=google header.b=vrRs5jvx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=ajou.ac.kr Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m11si261487ejl.347.2022.01.26.14.21.43; Wed, 26 Jan 2022 14:22:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ajou.ac.kr header.s=google header.b=vrRs5jvx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=ajou.ac.kr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243495AbiAZRAq (ORCPT + 99 others); Wed, 26 Jan 2022 12:00:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236857AbiAZRAc (ORCPT ); Wed, 26 Jan 2022 12:00:32 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AFFAC06173B for ; Wed, 26 Jan 2022 09:00:32 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id z131so10574199pgz.12 for ; Wed, 26 Jan 2022 09:00:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ajou.ac.kr; s=google; h=from:to:cc:subject:date:message-id; bh=ZLHyK20O5fjF8tpaoo4j4wWZ9TVY0iYMrpJ/AYsNoaQ=; b=vrRs5jvx6MkUUyv2+3VMlJ0DdZKdb5shEnyiX6qp1PYWk/jGgYvTT5hwB+VXIgNNh/ Sss0qn3KCFbxifeoskWZw8SC5TMnXCX/L1/7Q6Da2k0lUBZj/MLhH6/gP/BGcjs65Ujt G1OWv1P2NOFGz8C73t9E4E0auwqGR5PwM8qrQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZLHyK20O5fjF8tpaoo4j4wWZ9TVY0iYMrpJ/AYsNoaQ=; b=dJzgihyBZIMKSinBqo9jqSXUqpRbi2Lpw6BhO3qlzXl+n7oasLxByAyE7bRHpIn8fe 0tiEMzHNMr2nBikzxsqvcUAj5RY98v1P8hImh5CYM8gV1rw2BJ16wlbKwpaTVNVw7gi5 bKTkrnV5WC1EAKV4cQ9qVt+Z7Ivf0B9tEgv9UAKSoef3ll1o3wAyI5gyDTgBSC1RsXMF YAbNlsQjLyQX+geKKVOe7+ohebD0ASy0KrdAn+gKfqVjOfFWMg0vq/d4IB8ZpwHp5nW5 bEwMSSevWi6oib7gDF7flznZLakhfDc4gCMnq49Qt99OvxVABaxBxMa017ClQqDeKs4t /Ssw== X-Gm-Message-State: AOAM533xHA75+BIyb9HHG4S5CKaaFZiALhLJ0kEf5fdi0WHiBLBnLfL0 l0OrKCwTVlNO4TAD8dk3aLYuDA== X-Received: by 2002:a65:578b:: with SMTP id b11mr11425671pgr.318.1643216431459; Wed, 26 Jan 2022 09:00:31 -0800 (PST) Received: from localhost.localdomain ([210.107.197.32]) by smtp.googlemail.com with ESMTPSA id q6sm17540644pgb.85.2022.01.26.09.00.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 09:00:31 -0800 (PST) From: Jonghyeon Kim To: dan.j.williams@intel.com Cc: vishal.l.verma@intel.com, dave.jiang@intel.com, akpm@linux-foundation.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Jonghyeon Kim Subject: [PATCH 1/2] mm/memory_hotplug: Export shrink span functions for zone and node Date: Thu, 27 Jan 2022 02:00:01 +0900 Message-Id: <20220126170002.19754-1-tome01@ajou.ac.kr> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Export shrink_zone_span() and update_pgdat_span() functions to head file. We need to update real number of spanned pages for NUMA nodes and zones when we add memory device node such as device dax memory. Signed-off-by: Jonghyeon Kim --- include/linux/memory_hotplug.h | 3 +++ mm/memory_hotplug.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index be48e003a518..25c7f60c317e 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -337,6 +337,9 @@ extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn, extern void remove_pfn_range_from_zone(struct zone *zone, unsigned long start_pfn, unsigned long nr_pages); +extern void shrink_zone_span(struct zone *zone, unsigned long start_pfn, + unsigned long end_pfn); +extern void update_pgdat_span(struct pglist_data *pgdat); extern bool is_memblock_offlined(struct memory_block *mem); extern int sparse_add_section(int nid, unsigned long pfn, unsigned long nr_pages, struct vmem_altmap *altmap); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 2a9627dc784c..38f46a9ef853 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -389,7 +389,7 @@ static unsigned long find_biggest_section_pfn(int nid, struct zone *zone, return 0; } -static void shrink_zone_span(struct zone *zone, unsigned long start_pfn, +void shrink_zone_span(struct zone *zone, unsigned long start_pfn, unsigned long end_pfn) { unsigned long pfn; @@ -428,8 +428,9 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn, } } } +EXPORT_SYMBOL_GPL(shrink_zone_span); -static void update_pgdat_span(struct pglist_data *pgdat) +void update_pgdat_span(struct pglist_data *pgdat) { unsigned long node_start_pfn = 0, node_end_pfn = 0; struct zone *zone; @@ -456,6 +457,7 @@ static void update_pgdat_span(struct pglist_data *pgdat) pgdat->node_start_pfn = node_start_pfn; pgdat->node_spanned_pages = node_end_pfn - node_start_pfn; } +EXPORT_SYMBOL_GPL(update_pgdat_span); void __ref remove_pfn_range_from_zone(struct zone *zone, unsigned long start_pfn, -- 2.17.1