From patchwork Tue May 8 02:32:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huaisheng HS1 Ye X-Patchwork-Id: 10385139 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 700B860236 for ; Tue, 8 May 2018 02:33:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D63427F17 for ; Tue, 8 May 2018 02:33:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 518A62858B; Tue, 8 May 2018 02:33:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92D5827F17 for ; Tue, 8 May 2018 02:33:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 647956B000A; Mon, 7 May 2018 22:33:08 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5F8286B000C; Mon, 7 May 2018 22:33:08 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4BFAB6B000D; Mon, 7 May 2018 22:33:08 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f199.google.com (mail-qt0-f199.google.com [209.85.216.199]) by kanga.kvack.org (Postfix) with ESMTP id 2523A6B000A for ; Mon, 7 May 2018 22:33:08 -0400 (EDT) Received: by mail-qt0-f199.google.com with SMTP id x2-v6so23004021qto.10 for ; Mon, 07 May 2018 19:33:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:thread-topic :thread-index:date:message-id:references:in-reply-to:accept-language :content-language:spamdiagnosticoutput:spamdiagnosticmetadata :content-transfer-encoding:mime-version; bh=RfFuKJDKwklvhhTyDC8ktOm4clR8b2q5Pi5fwmSFmS0=; b=crAb2Ygxo/0AmHbKD6Xo8Wh3ms2qza0jlPDt0/JiSzdqv0RTnUY3CAFlArKL7rtK6y z+KBKPKmE9dHZ9Nvks5Ql2dLftDII6vEX2WO+5ZJjnym2TJOc09nQtjxtTfDSnc8Nyyk p1he4OfbaHvnJ5kUdA6RlTJXFB6jqfdnNd3DKe2fwaC8E5cz58T7a4BxzRV+ZSAQ27H8 OlBEaT4BIAu3pZlMECabyV+lb48avq8lx/N1mdCdN7eOHyQOfHK0jOABVWq7UslQfG+Z 05wWHWv11gpgJxlkNU8plZvZTOCz1P4+ZDj/Q05BIx/Pib2NlwHwAz+BCAuOQFD7VqmD 5I+w== X-Gm-Message-State: ALQs6tCS6/gpRZvkn7erG02S9OjIPnc5k+ezdMYf1By8+7DC7S01v/Ls E8h+WBGseNnRbnU/kjcHqBAt/i7lR72bsZOaK3efl1PwjGj9PvSpPRw+GzBgXJ6Y8hQrNZuo4r7 k8ydh7ZHHn3zFiVt60Sbrh/72z5w16YqbEi7Yl5PMwxLZvf5j5+RE8Lh2XbpIK1k2MA== X-Received: by 10.55.119.196 with SMTP id s187mr32640076qkc.171.1525746787912; Mon, 07 May 2018 19:33:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrZcq8aMH11nnRU2ODcJTFK8ZVgVWJm0xSSLWVgq8XwI9szV+horY8oz8APWY4OPS/HMwkp X-Received: by 10.55.119.196 with SMTP id s187mr32640053qkc.171.1525746787350; Mon, 07 May 2018 19:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525746787; cv=none; d=google.com; s=arc-20160816; b=AZy94mcR1Bi8rKYz/qEOsTMxupebjnB4eOFLq/Oe6kwRHom8/3Ehc/fMkOLn3d4Ubt vdnuVFpA+96Wa5T41uCRlOWhNEL6aaRnitG3QhGwwfEKAkr3MKq0UNcBlKbIS97pONsZ VHSFx0nllFKGiTmM69wnBJE6yDna5rYwRYuUme6hxR3a/3fhcBwDWHq0tRoxjRYCBy4U tL4owo9GOV7mthw+ey9RatR4dJQMisvNCnjsxpcd8XcfwwTbslOQ41wy3LKMP57QyKKR yKV3yniLklmauNxSq4uaNjYzzYfYeYkX9c/wGsFHKy3Zw1viETrMLn0RDDlyVhCkZ/Xe cfZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:spamdiagnosticmetadata :spamdiagnosticoutput:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=RfFuKJDKwklvhhTyDC8ktOm4clR8b2q5Pi5fwmSFmS0=; b=wP50RE6bDAG8x6cWdpC7r6YEYhWfEwrKJ02R6Y+N21ymZUYNg2txGAPYNlgqhFN4+R yAsQtwyq4D52p4pGRJjEnTpVT68GRMNsGn/P/I7uz6ubWNXXyJ97kWwKvii6NUYOlFTk gBLxJ8bBMrlrUofVe4+mdYVrpjCH6gNcNHYEzCV9oKm1SHjrLl6XuWbKZhlscnJhsw3f MY3OdgnNyFwVKidGFzJth4ou0i9XpNahKR1obxcUbe93kNAwfOQz6nPoxUWNsbjLFGWm Lb+41IHqWkp5+1tSc7J6uKnq1fXfmc3wSe0L83coOKLWXCMxbX2f4P8C4SIKVVSKXG/Z d31g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@LenovoBeijing.onmicrosoft.com header.s=selector1-lenovo-com header.b=mMTabNG0; spf=pass (google.com: domain of yehs1@lenovo.com designates 216.82.243.201 as permitted sender) smtp.mailfrom=yehs1@lenovo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lenovo.com Received: from mail1.bemta8.messagelabs.com (mail1.bemta8.messagelabs.com. [216.82.243.201]) by mx.google.com with ESMTPS id o14-v6si3167070qto.293.2018.05.07.19.33.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 May 2018 19:33:07 -0700 (PDT) Received-SPF: pass (google.com: domain of yehs1@lenovo.com designates 216.82.243.201 as permitted sender) client-ip=216.82.243.201; Authentication-Results: mx.google.com; dkim=pass header.i=@LenovoBeijing.onmicrosoft.com header.s=selector1-lenovo-com header.b=mMTabNG0; spf=pass (google.com: domain of yehs1@lenovo.com designates 216.82.243.201 as permitted sender) smtp.mailfrom=yehs1@lenovo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lenovo.com Received: from [216.82.242.41] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-9.bemta-8.messagelabs.com id A5/B6-15733-36C01FA5; Tue, 08 May 2018 02:33:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpll+JIrShJLcpLzFFi42JJl3ulo5vE8zH KYP10A4s569ewWSzal2ExvfE8u8XqTb4Wl3fNYbO4t+Y/q0XzxNvsFjuW7mOyuN/nYNF6eCeL xeyWd6wWsxv7GC1+/5jD5sDrcfjNe2aPnWtXMXlsXqHlsenTJHaPEzN+s3h0z/7H4vHx6S0Wj /VbrrJ4nFlwhN1j8+lqj62/7Dxav4t6fN4kF8AbxZqZl5RfkcCacXDNX5aCpwIVDWdb2RsYJ/ B1MXJxCAk8Z5T4P3ciC4RzlFHi74W5bCAOi0APs8T02c8YITK9TBI3N3SzQjh3GCWWfG0Gcjg 52AQ0JU6+ucbcxcjBISKQLnH+SQZIDbNAL6vE94ubmUBqhAXiJM4+WscCYosIJEtsW/GCHcI2 kjh+9B8ziM0ioCKxas9ksDivQIzEik07wHqFBCokXvf9AOvlFHCS+HJ/IhuIzSggKzHt0X2wG mYBcYm502aB3SMhICCxZM95ZghbVOLl439QcSWJWQeXQNmyEpfmd4N9JiEwgVWi584qJoiEoc TxlfuZIRINbBKLtkxkhXC2MUpcPnoaql1LYum5OywgL0sIZEtMWFcAEbaU6Lh0gwXClpNY1fu QBaJ3JbPExS27GSESMhJz7u5jgXgtQ+Lfkj9MExj1ZyH5AsLWkViw+xMbhK0tsWzha+ZZ4JAR lDg58wnLAkaWVYwaxalFZalFuiaGeklFmekZJbmJmTm6hgYWermpxcWJ6ak5iUnFesn5uZsYg UmynoGBcQfj62XRhxglOZiURHnLWD5GCfEl5adUZiQWZ8QXleakFh9ilOHgUJLgfcAFlBMsSk 1PrUjLzAGma5i0BAePkgjvPZA0b3FBYm5xZjpE6hSjLseaLZN6mIVY8vLzUqXEecW4gYoEQIo ySvPgRsByxyVGWSlhXkYGBgYhnoLUotzMElT5V4ziHIxKwrxaIFN4MvNK4Da9AjqCCegIwQfv QY4oSURISTUwTg7xZyr4v6nWK/uc9ktfA9NHP7dlnDUUl+med8K4++HPjwYHQms7mQv7be+r8 AkrtidkZS3wmlWVdDbrRIP6WUf1s13Bqmuv3arknfQtsfO9c8CF6dN9nmwtyV44S7ghoHyjwq fD5/mqv+9iu1s/8a5+7PuTwlZTdBr0tb15g2/ci/gb6xanxFKckWioxVxUnAgAO5KEiBgEAAA = X-Env-Sender: yehs1@lenovo.com X-Msg-Ref: server-6.tower-218.messagelabs.com!1525746776!22725576!1 X-Originating-IP: [103.30.234.44] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.9.15; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29522 invoked from network); 8 May 2018 02:33:06 -0000 Received: from unknown (HELO mapsmtp02.lenovo.com) (103.30.234.44) by server-6.tower-218.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 8 May 2018 02:33:06 -0000 Received: from HKGWPEXCH02.lenovo.com (unknown [10.128.62.31]) by mapsmtp02.lenovo.com with smtp (TLS: TLSv1/SSLv3,256bits,ECDHE-RSA-AES256-SHA) id 3e08_d64b_48f66e3e_bfd4_401e_96f0_61e8c53ab08b; Tue, 08 May 2018 10:32:49 +0800 Received: from APC01-HK2-obe.outbound.protection.outlook.com (65.55.88.209) by HKGWPEXCH02.lenovo.com (10.128.62.31) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 8 May 2018 10:32:48 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=LenovoBeijing.onmicrosoft.com; s=selector1-lenovo-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=RfFuKJDKwklvhhTyDC8ktOm4clR8b2q5Pi5fwmSFmS0=; b=mMTabNG0hBLkveam9H/Yy5cF01Uy0geDVnzdZxb8rcvFtN36/aT0J+qemSOBx6bJUZZXwe6UbH3gGvaNjE0zAjl75vghmi+FANsCgwpodhdeO9HzDVmv929LqCP7b0x8Kr5m0O6/R/Oju9o1kEG9rHJBrEC+SHX55qtcL+1VHrI= Received: from HK2PR03MB1684.apcprd03.prod.outlook.com (10.165.178.14) by HK2PR03MB1490.apcprd03.prod.outlook.com (10.165.57.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.755.10; Tue, 8 May 2018 02:32:48 +0000 Received: from HK2PR03MB1684.apcprd03.prod.outlook.com ([fe80::d87a:89b7:f377:f5d]) by HK2PR03MB1684.apcprd03.prod.outlook.com ([fe80::d87a:89b7:f377:f5d%4]) with mapi id 15.20.0755.012; Tue, 8 May 2018 02:32:48 +0000 From: Huaisheng HS1 Ye To: "akpm@linux-foundation.org" , "linux-mm@kvack.org" CC: "mhocko@suse.com" , "willy@infradead.org" , "vbabka@suse.cz" , "mgorman@techsingularity.net" , "pasha.tatashin@oracle.com" , "alexander.levin@verizon.com" , "hannes@cmpxchg.org" , "penguin-kernel@I-love.SAKURA.ne.jp" , "colyli@suse.de" , NingTing Cheng , "Ocean HY1 He" , "linux-kernel@vger.kernel.org" , "linux-nvdimm@lists.01.org" Subject: [External] [RFC PATCH v1 2/6] mm/page_alloc.c: get pfn range with flags of memblock Thread-Topic: [External] [RFC PATCH v1 2/6] mm/page_alloc.c: get pfn range with flags of memblock Thread-Index: AQHT5nLwVHl4qe8WykyzbX8ZVhdgSqQlHIMA Date: Tue, 8 May 2018 02:32:47 +0000 Message-ID: References: <1525746628-114136-1-git-send-email-yehs1@lenovo.com> <1525746628-114136-3-git-send-email-yehs1@lenovo.com> In-Reply-To: <1525746628-114136-3-git-send-email-yehs1@lenovo.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [111.197.250.78] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HK2PR03MB1490; 7:koBtzTy7mCcmMFfDppu3KKJVoSSfAijiM06z452z0TNGyOJbNL9MgHY0Gi1HqPoGrUL+BtwTIfNRvRZ5PZGQneeRREuRDabHQ0I0uhx3zF+6rjeoAz5G0pulpTZcD7QllnMqKhcDEfHekMGn9prFT5k1SvmNhkOeMQFJFVrzTXDX2ohBCW4AsR5tnvfQiGyxZn4D1Bb3KTJ+r7sqwBORomjQ/EiEKjPzPyYsbpvD9hRgQR/zE4NYKlxJ0vCVaV7L; 20:Urg9TRN9V9jOHYctkMV/gkVvwG2MBgaNmghZPFOzEwy46EVvo+sjxCGkfgqVk5fzBnUZTna/ZC+qdWoxIlRzBEO2K5wgfXNpRS32qVJbnPEwHSvVTGmTQtmWwcv1XWVDxPP5KoXV7d2EXTCk1Sz+KKqzFrMAzeNf9pt7Kv0IZ9Av3savpj2HFhdwzCzf7+4vJFfy6NLUaqk/8txyiJi2lpcbZ1gK/lZgve8/iaHDA550Dw9OpQfL19ILeaOZNHjTf88ocgFLecfyE6txYjkyJfY4JA4BZh8bLkuzF0TcVOQmnrOk46N9C3Nenm9M1uAVwbN+mI8W5XfCkeYYvyX1Jw== x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10019020)(396003)(346002)(366004)(39850400004)(39380400002)(376002)(199004)(189003)(186003)(4326008)(68736007)(11346002)(476003)(99286004)(33656002)(6346003)(446003)(25786009)(6436002)(102836004)(53936002)(9686003)(7736002)(81166006)(8936002)(26005)(81156014)(8676002)(316002)(55016002)(486006)(54906003)(110136005)(305945005)(76176011)(59450400001)(7416002)(2900100001)(6506007)(6116002)(3846002)(2906002)(14454004)(66066001)(5660300001)(74316002)(86362001)(3660700001)(105586002)(106356001)(478600001)(97736004)(5250100002)(2501003)(7696005)(3280700002)(13296004)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR03MB1490; H:HK2PR03MB1684.apcprd03.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:HK2PR03MB1490; x-ms-traffictypediagnostic: HK2PR03MB1490: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(3940261145250); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:HK2PR03MB1490; BCL:0; PCL:0; RULEID:; SRVR:HK2PR03MB1490; x-forefront-prvs: 0666E15D35 Received-SPF: None (HKGWPEXCH02.lenovo.com: yehs1@lenovo.com does not designate permitted sender hosts) received-spf: None (protection.outlook.com: lenovo.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: TnsSkhtiT/fUymM4zMzYpeoqIcxrXVNKyjN4Ozww+QpcitJgxWzSx96n2Y4UEkPD4kPLecKFJ25mkbUkdNYvWygbAWlK+fg7qb6dtjWBTgpk5iW7yb5s+jcQ9gqS8NxZ5371GmpoxL3oqC3o6S2HeJYpLDN5urN86wVRR29QDtEoAxg/Ycb06Fo0C2/I/7r5 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: deee0964-d9a0-4262-c979-08d5b48bfd06 X-MS-Exchange-CrossTenant-Network-Message-Id: deee0964-d9a0-4262-c979-08d5b48bfd06 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 May 2018 02:32:47.9125 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5c7d0b28-bdf8-410c-aa93-4df372b16203 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR03MB1490 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP This is used to expand the interface of get_pfn_range_for_nid with flags of memblock, so mm can get pfn range with special flags. Signed-off-by: Huaisheng Ye Signed-off-by: Ocean He --- include/linux/mm.h | 4 ++++ mm/page_alloc.c | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index ad06d42..8abf9c9 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2046,6 +2046,10 @@ extern unsigned long absent_pages_in_range(unsigned long start_pfn, unsigned long end_pfn); extern void get_pfn_range_for_nid(unsigned int nid, unsigned long *start_pfn, unsigned long *end_pfn); +extern void get_pfn_range_for_nid_with_flags(unsigned int nid, + unsigned long *start_pfn, + unsigned long *end_pfn, + unsigned long flags); extern unsigned long find_min_pfn_with_active_regions(void); extern void free_bootmem_with_active_regions(int nid, unsigned long max_low_pfn); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1741dd2..266c065 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5705,13 +5705,28 @@ void __init sparse_memory_present_with_active_regions(int nid) void __meminit get_pfn_range_for_nid(unsigned int nid, unsigned long *start_pfn, unsigned long *end_pfn) { + get_pfn_range_for_nid_with_flags(nid, start_pfn, end_pfn, + MEMBLOCK_MAX_TYPE); +} + +/* + * If MAX_NUMNODES, includes all node memmory regions. + * If MEMBLOCK_MAX_TYPE, includes all memory regions with or without Flags. + */ + +void __meminit get_pfn_range_for_nid_with_flags(unsigned int nid, + unsigned long *start_pfn, + unsigned long *end_pfn, + unsigned long flags) +{ unsigned long this_start_pfn, this_end_pfn; int i; *start_pfn = -1UL; *end_pfn = 0; - for_each_mem_pfn_range(i, nid, &this_start_pfn, &this_end_pfn, NULL) { + for_each_mem_pfn_range_with_flags(i, nid, &this_start_pfn, + &this_end_pfn, NULL, flags) { *start_pfn = min(*start_pfn, this_start_pfn); *end_pfn = max(*end_pfn, this_end_pfn); }