From patchwork Mon Nov 19 03:48:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 10688169 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 20D49109C for ; Mon, 19 Nov 2018 03:49:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A84242963C for ; Mon, 19 Nov 2018 03:48:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C38729644; Mon, 19 Nov 2018 03:48:56 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 1D3CE2963C for ; Mon, 19 Nov 2018 03:48:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 16D926B1864; Sun, 18 Nov 2018 22:48:55 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 11D896B1865; Sun, 18 Nov 2018 22:48:55 -0500 (EST) 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 00C706B1866; Sun, 18 Nov 2018 22:48:54 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by kanga.kvack.org (Postfix) with ESMTP id B5FFE6B1864 for ; Sun, 18 Nov 2018 22:48:54 -0500 (EST) Received: by mail-pg1-f199.google.com with SMTP id k125so19652840pga.5 for ; Sun, 18 Nov 2018 19:48:54 -0800 (PST) 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:date :message-id; bh=4pXnBsYnxVzB2pIzab27J1mJQTRrO8Vr/zbYtgjuP8I=; b=ZQ8xqulx5+zPg1iExXnTOMLNfTdxXQOGannDCIDqAfzi+yCLyFq1bmsZh40glbmDXV JEzsmomzkNLdJeVFXHAyHlHoprgJnMWn8gyoH1OwI8E5g/nlgTHpk3AYwLl/P+vsNujd 3+w+BoLZ912+bksPnC2JaH0YxR3Fx6E+GA/xThmJAFS6jT/T8cJdsrrvQTG0IudXzU4S +nD5yZRvys1jceZnDmYU/Z3mWZjrswbFhPqz6ohn00g5Is+bqFcdfu2lK5JZAgFw/d4N diC06z++oIv+uq9M74iF6Gd/UFbkiq76RQPFuVSKFXjsmVqcAGOx0FDOWG/qe9bOOuac MZ9A== X-Gm-Message-State: AGRZ1gLkqJOrfc9lZpp9WdS5BBSJhvQkG+UuQ4UMMFmE650dDBw8NFCu du+mmhWn7XsEEPvnC2JHK4R5vnpU+NwsoHfK/GX7GQRJZ7UiNgllm2ACQ1CTokVbMvQS/quj3va f655WD0o/JluY+Io6J/fucjpyZZek4cdD5uyS+1nI7bVaIp7NMJrxYyGMk8iPlbzsQ3Pj2heSMP ynRf8Ci21X3r22ohlZwXKsZNaeJx4CQV8a8lLKW5WXiQ5/+uLAxvw9C5Yry7LxK0HU9cOxmmnu/ zYXt2dZvQklNmIHaidXd9/61TBZvM6yjI/6GBXaqwO6hXTln+zTPm/xvyF5LdNNyrjFOvvJC6eE 2nk2sFEUwditqLo7os6wuAEwcp9sNuzcNQ/ZoPQFA/YS/x7Ksdh23OlLAq/tXB18IzXPIVBreD0 2 X-Received: by 2002:a17:902:b90c:: with SMTP id bf12-v6mr19654115plb.1.1542599334247; Sun, 18 Nov 2018 19:48:54 -0800 (PST) X-Received: by 2002:a17:902:b90c:: with SMTP id bf12-v6mr19654082plb.1.1542599333475; Sun, 18 Nov 2018 19:48:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542599333; cv=none; d=google.com; s=arc-20160816; b=zzk8lpbru330eQc2uLUQWE0jc2nWWwsVBcl/tRKcs0s8UxLCbvew4QLTnsqZ37mjZc O3mbbif7BW4EueOnHduEY657Mlq3LkxczmFK22JTkplkLO8lyOqZNQTsKKW5qUl3r5Gi lqBC1n71ph7lyKorgOo9W4z76FUsosOaLT7I1wvlLHF2OwuYtIJakl2x8KELff1y3N2c my7YcyixHM6YATlHcXu2WSllg2p42irRHuJJHrRa0uyJ9zHhBKaBbx06L6jn/+llD/fg Oajq5GeJGUW+nBMpy09kfq7Ev27gkhyopU93y0gthwbLUX4AZ/0daBj6JPGW+APZcGBO BTSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=4pXnBsYnxVzB2pIzab27J1mJQTRrO8Vr/zbYtgjuP8I=; b=KUSDYLyKYGAKlyD5cNdbowvOi5FmgPqcyb5g7x4B4c3rQdHVgOnKa0j9byjQSdUJfT XCl9MufRpExqzmlEkEQPmnvPhxdM4hpt2Ohq1/fwjpNIOLWSFMKlAOjD+xfAFY3JDZCN YycezR0KVRgW79ulhQbp6RKFCShC3iKo9vVnY/v7sWWY+e86Zg2FejS75n72yA8lQk1G 4UfKoR5MpIOiOn4VNKwDnQOF2atDgUUU6wY3Nddb2NqzQfUEHP5g/tircuPKq0x7/o3i 1Ebf1bsNavAE7DKUILBfHtH7UFthXKPGVwIlZJaXQ3/hGUrYrs1P7Fbeq1I7HEieCknX V3LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hE7OmAS0; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id t186sor22208179pgd.63.2018.11.18.19.48.53 for (Google Transport Security); Sun, 18 Nov 2018 19:48:53 -0800 (PST) Received-SPF: pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hE7OmAS0; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=4pXnBsYnxVzB2pIzab27J1mJQTRrO8Vr/zbYtgjuP8I=; b=hE7OmAS09yOIjQXou7N3wiShOUysWd7AO06ANDHJ4Mth50sXgQIY5sXgd7+PoLlmVq fVdwld+PN2SNth2Rim9mDSrdsW138yzTwX4vuKNV5nigDEfw5r94It7YuAjPo1hH2Fy+ kgWqQvUeDujyRJxDvvXjwpMWzcaGPoEarkIMhB9rD8qhOoCfQ2lqaFvX7oKSRte3UaZJ eZ1Ut4oexd6Dtvu1qfYFYhdqN/w8LHg7knDxzj7kYp9+mU9eZ3bfff/WQE4CF9fAmDhd z+flKSgrFZtBTbWdRIBIaoz3dclXokx/W8ddoyiVaJMNLXIUo8eOQeC7pNGenp/uCEC2 guMg== X-Google-Smtp-Source: AJdET5fUOQ5/FTqVdWzRp7Zu8h2ukBUzL5sFGjpsboXpcXRc+4MvCPrXpC7ULdaV3zbpmutLY6c0PA== X-Received: by 2002:a63:ed42:: with SMTP id m2mr18850542pgk.147.1542599333034; Sun, 18 Nov 2018 19:48:53 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id q7sm12181276pgp.40.2018.11.18.19.48.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Nov 2018 19:48:52 -0800 (PST) From: Wei Yang To: mgorman@suse.de, pavel.tatashin@microsoft.com Cc: akpm@linux-foundation.org, linux-mm@kvack.org, Wei Yang Subject: [RFC PATCH] mm, meminit: remove init_reserved_page() Date: Mon, 19 Nov 2018 11:48:45 +0800 Message-Id: <20181119034845.20469-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.15.1 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 Function init_reserved_page() is introduced in commit 7e18adb4f80b ("mm: meminit: initialize remaining struct pages in parallel with kswapd"). While I am confused why it uses for_each_mem_pfn_range() in deferred_init_memmap() to initialize deferred pages structure. After commit 2f47a91f4dab ("mm: deferred_init_memmap improvements"), deferred_init_memmap() uses for_each_free_mem_range() to initialize page structure. This means the reserved memory is not touched. The original context before commit 7e18adb4f80b ("mm: meminit: initialize remaining struct pages in parallel with kswapd"), reserved memory's page structure is just SetPageReserved, which means they are not necessary to be initialized. This patch removes init_reserved_page() to restore the original context. Signed-off-by: Wei Yang --- I did bootup and kernel build test with the patched kernel, it looks good. One of my confusion is the commit 7e18adb4f80b ("mm: meminit: initialize remaining struct pages in parallel with kswapd") works fine. Does it eat some reserved pages? Either I don't see the reason in commit 2f47a91f4dab ("mm: deferred_init_memmap improvements") of changing pfn iteration from for_each_mem_pfn_range() to for_each_free_mem_range(). Another question is in function reserve_bootmem_region(), we add a INIT_LIST_HEAD() in commit 1d798ca3f164 ("mm: make compound_head() robust"). While the reserved page is never visible in page allocator. Do we still need to do this step? --- mm/page_alloc.c | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 2d3c54201255..48cf24766343 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1192,32 +1192,6 @@ static void __meminit __init_single_page(struct page *page, unsigned long pfn, #endif } -#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT -static void __meminit init_reserved_page(unsigned long pfn) -{ - pg_data_t *pgdat; - int nid, zid; - - if (!early_page_uninitialised(pfn)) - return; - - nid = early_pfn_to_nid(pfn); - pgdat = NODE_DATA(nid); - - for (zid = 0; zid < MAX_NR_ZONES; zid++) { - struct zone *zone = &pgdat->node_zones[zid]; - - if (pfn >= zone->zone_start_pfn && pfn < zone_end_pfn(zone)) - break; - } - __init_single_page(pfn_to_page(pfn), pfn, zid, nid); -} -#else -static inline void init_reserved_page(unsigned long pfn) -{ -} -#endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ - /* * Initialised pages do not have PageReserved set. This function is * called for each range allocated by the bootmem allocator and @@ -1233,8 +1207,6 @@ void __meminit reserve_bootmem_region(phys_addr_t start, phys_addr_t end) if (pfn_valid(start_pfn)) { struct page *page = pfn_to_page(start_pfn); - init_reserved_page(start_pfn); - /* Avoid false-positive PageTail() */ INIT_LIST_HEAD(&page->lru);