From patchwork Wed Jun 2 09:14:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 12295095 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 C3002C47083 for ; Wed, 2 Jun 2021 15:18:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 71C3961246 for ; Wed, 2 Jun 2021 15:18:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71C3961246 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7C6846B008C; Wed, 2 Jun 2021 11:18:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 68E436B0095; Wed, 2 Jun 2021 11:18:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43EFE6B0092; Wed, 2 Jun 2021 11:18:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0034.hostedemail.com [216.40.44.34]) by kanga.kvack.org (Postfix) with ESMTP id 1340C6B008C for ; Wed, 2 Jun 2021 11:18:34 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B531F180AD804 for ; Wed, 2 Jun 2021 15:18:33 +0000 (UTC) X-FDA: 78209140506.36.5226033 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf17.hostedemail.com (Postfix) with ESMTP id 026674202A14 for ; Wed, 2 Jun 2021 15:18:22 +0000 (UTC) Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0342333681; Wed, 2 Jun 2021 15:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622647111; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=ATheSSLLZ2P8MhU+2J3xNMWL+VSgOZk/hQ1TADrnaks=; b=RktuDgHxXX9qk0TdyvY443prykckoRzOTLV5fpx5qHhAslfQ66GoKH+CLP3lPtwvAw4Bn0 mZkkJCv87vll6SAugeRnHgmKJlw2BE3pbsjUb0jBfXIjK4isU5LU7MmH/pLrLaNPTm0v5P LMUe0qOZGVOGbOUDLUPOwrrANyw1ABU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622647111; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=ATheSSLLZ2P8MhU+2J3xNMWL+VSgOZk/hQ1TADrnaks=; b=7EjBXnruDEMEdOxQjQm/Tn5Tis49KJPSFGiDKw14qVt2BiQP15LxUkjvOuom2jClxLmeN1 iYoRysZxnMjcCCAg== Received: by imap.suse.de (Postfix, from userid 51) id F17D511CD7; Wed, 2 Jun 2021 15:28:32 +0000 (UTC) Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 041A211D1D; Wed, 2 Jun 2021 09:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622625309; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=ATheSSLLZ2P8MhU+2J3xNMWL+VSgOZk/hQ1TADrnaks=; b=1CSir7kFrq/6l+vnYYjUHflh/ejKn7fulZUuf1vptmstMV3mHI+zop4H0al1+twDnGlbjX NK+5ZvzvN636e6axM/APtEWnvu64ymGnvPNBSQdveo0dnI+kAdTCMD19KlU0+43KeVKtQV V5DQf6ZZ0qL+1TipgvhTMrKU1tZs9ug= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622625309; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=ATheSSLLZ2P8MhU+2J3xNMWL+VSgOZk/hQ1TADrnaks=; b=7Kx1H8sSjrn2Y7RvWTpNtp4BoNOK9aJkDUQlb47cE031M9Y2elxYflmUMHc51rtyiKlpQV gADk3P5e5YVyNICw== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id UCDUOBxMt2A6HgAALh3uQQ (envelope-from ); Wed, 02 Jun 2021 09:15:08 +0000 From: Oscar Salvador To: Andrew Morton Cc: David Hildenbrand , Dave Hansen , Michal Hocko , Anshuman Khandual , Vlastimil Babka , Pavel Tatashin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [PATCH v2 1/3] mm,page_alloc: Use {get,put}_online_mems() to get stable zone's values Date: Wed, 2 Jun 2021 11:14:55 +0200 Message-Id: <20210602091457.17772-2-osalvador@suse.de> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20210602091457.17772-1-osalvador@suse.de> References: <20210602091457.17772-1-osalvador@suse.de> Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=RktuDgHx; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7EjBXnru; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=1CSir7kF; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7Kx1H8sS; spf=pass (imf17.hostedemail.com: domain of osalvador@suse.de designates 195.135.220.28 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=none X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 026674202A14 X-Stat-Signature: 1p8qxbgtoep85t7tfpxf1trhyxgy8wid X-HE-Tag: 1622647102-827160 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: Currently, page_outside_zone_boundaries() takes zone's span_seqlock when reading zone_start_pfn and spanned_pages so those values are stable vs memory hotplug operations. move_pfn_range_to_zone() and remove_pfn_range_from_zone(), which are the functions that can change zone's values are serialized by mem_hotplug_lock by mem_hotplug_{begin,done}, so we can just use {get,put}_online_mems() on the readers. This will allow us to completely kill span_seqlock lock as no users will remain after this series. Signed-off-by: Oscar Salvador Reported-by: kernel test robot --- mm/page_alloc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index aaa1655cf682..296cb00802b4 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -582,17 +582,15 @@ void set_pageblock_migratetype(struct page *page, int migratetype) static int page_outside_zone_boundaries(struct zone *zone, struct page *page) { int ret = 0; - unsigned seq; unsigned long pfn = page_to_pfn(page); unsigned long sp, start_pfn; - do { - seq = zone_span_seqbegin(zone); - start_pfn = zone->zone_start_pfn; - sp = zone->spanned_pages; - if (!zone_spans_pfn(zone, pfn)) - ret = 1; - } while (zone_span_seqretry(zone, seq)); + get_online_mems(); + start_pfn = zone->zone_start_pfn; + sp = zone->spanned_pages; + if (!zone_spans_pfn(zone, pfn)) + ret = 1; + put_online_mems(); if (ret) pr_err("page 0x%lx outside node %d zone %s [ 0x%lx - 0x%lx ]\n", From patchwork Wed Jun 2 09:14:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 12295091 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 52F6FC47092 for ; Wed, 2 Jun 2021 15:18:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C36FC60698 for ; Wed, 2 Jun 2021 15:18:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C36FC60698 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4412F6B0088; Wed, 2 Jun 2021 11:18:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 30D356B008C; Wed, 2 Jun 2021 11:18:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F15326B0092; Wed, 2 Jun 2021 11:18:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0132.hostedemail.com [216.40.44.132]) by kanga.kvack.org (Postfix) with ESMTP id B1D2E6B0089 for ; Wed, 2 Jun 2021 11:18:32 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5459BE0B2 for ; Wed, 2 Jun 2021 15:18:32 +0000 (UTC) X-FDA: 78209140464.13.3DCCD07 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf15.hostedemail.com (Postfix) with ESMTP id 3C5A4A00026B for ; Wed, 2 Jun 2021 15:18:24 +0000 (UTC) Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E64FD21996; Wed, 2 Jun 2021 15:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622647110; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=Ov4ZcasJmGJkSNHBnIiGrTxrqHwuVMl6yhUHWLdDnFs=; b=1FCeLGtlmqY97MfoBMskRYl7Vl67U/XlkuHhMZKTwZbESucXPUh0c+lfMx65G4yeGLZXvv LyHhQQLeWKe/KuBA1mTcUxdAWWyP0He6Y1eWot9iXOjn2ky3OpUgWj/hgaK2ZbJHRY0vte TehzqV3tz0szGx36kSCr2wzR8k8bgGg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622647110; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=Ov4ZcasJmGJkSNHBnIiGrTxrqHwuVMl6yhUHWLdDnFs=; b=mXVIx5/P8ZrKKL5kxs8XqdT/SIZEuWeoJT9lgiZp8RoGEQIWxJpaEDb+ShhLDNvZGSUmGq v2i1VZy39QUyOHDQ== Received: by imap.suse.de (Postfix, from userid 51) id DE78111CD4; Wed, 2 Jun 2021 15:28:32 +0000 (UTC) Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id CFA1111D1E; Wed, 2 Jun 2021 09:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622625310; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=Ov4ZcasJmGJkSNHBnIiGrTxrqHwuVMl6yhUHWLdDnFs=; b=SDfzjOnHuxTEQxVDk+BUJSBm9VP4Oc0kDwmRcgoHXOrId0p//7IgoKPj8uSB3nu8OYUlS9 Ut549dkOmAdxgSd7JDqUK7fmZV1yk42nVpMxBJbIQB5vbZOBL0M6IyuGjnVYTqc38wlz48 cOjw/z3KTzi6WglXR8TELbcoRQYDAc8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622625310; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=Ov4ZcasJmGJkSNHBnIiGrTxrqHwuVMl6yhUHWLdDnFs=; b=Tq/TwiW76IDjzxwQu1QrWCHopBbgDNU1CI8dK3WQVXygPh0iDOrMlYBzaqmN/DeO4JO5ub s9AV6sGPwA4ahJCA== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id 6KNsLx1Mt2A6HgAALh3uQQ (envelope-from ); Wed, 02 Jun 2021 09:15:09 +0000 From: Oscar Salvador To: Andrew Morton Cc: David Hildenbrand , Dave Hansen , Michal Hocko , Anshuman Khandual , Vlastimil Babka , Pavel Tatashin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [PATCH v2 2/3] mm,memory_hotplug: Drop unneeded locking Date: Wed, 2 Jun 2021 11:14:56 +0200 Message-Id: <20210602091457.17772-3-osalvador@suse.de> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20210602091457.17772-1-osalvador@suse.de> References: <20210602091457.17772-1-osalvador@suse.de> Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=1FCeLGtl; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="mXVIx5/P"; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=SDfzjOnH; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="Tq/TwiW7"; dmarc=none; spf=pass (imf15.hostedemail.com: domain of osalvador@suse.de designates 195.135.220.28 as permitted sender) smtp.mailfrom=osalvador@suse.de X-Stat-Signature: 67qm8ocyh65ob4y3khf4ubagnw5bzfw1 X-Rspamd-Queue-Id: 3C5A4A00026B X-Rspamd-Server: rspam02 X-HE-Tag: 1622647104-122547 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: Currently, memory-hotplug code takes zone's span_writelock and pgdat's resize_lock when resizing the node/zone's spanned pages via {move_pfn_range_to_zone(),remove_pfn_range_from_zone()} and when resizing node and zone's present pages via adjust_present_page_count(). These locks are also taken during the initialization of the system at boot time, where it protects parallel struct page initialization, but they should not really be needed in memory-hotplug where all operations are a) synchronized on device level and b) serialized by the mem_hotplug_lock lock. Given that there are no users of span_seqlock, rip out all related functions. Signed-off-by: Oscar Salvador Acked-by: Michal Hocko --- include/linux/memory_hotplug.h | 35 ----------------------------------- include/linux/mmzone.h | 23 +++++------------------ mm/memory_hotplug.c | 16 +--------------- mm/page_alloc.c | 1 - 4 files changed, 6 insertions(+), 69 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 28f32fd00fe9..0d837ce6ec11 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -79,31 +79,7 @@ struct range mhp_get_pluggable_range(bool need_mapping); /* * Zone resizing functions - * - * Note: any attempt to resize a zone should has pgdat_resize_lock() - * zone_span_writelock() both held. This ensure the size of a zone - * can't be changed while pgdat_resize_lock() held. */ -static inline unsigned zone_span_seqbegin(struct zone *zone) -{ - return read_seqbegin(&zone->span_seqlock); -} -static inline int zone_span_seqretry(struct zone *zone, unsigned iv) -{ - return read_seqretry(&zone->span_seqlock, iv); -} -static inline void zone_span_writelock(struct zone *zone) -{ - write_seqlock(&zone->span_seqlock); -} -static inline void zone_span_writeunlock(struct zone *zone) -{ - write_sequnlock(&zone->span_seqlock); -} -static inline void zone_seqlock_init(struct zone *zone) -{ - seqlock_init(&zone->span_seqlock); -} extern int zone_grow_free_lists(struct zone *zone, unsigned long new_nr_pages); extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages); extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); @@ -248,17 +224,6 @@ void mem_hotplug_done(void); ___page; \ }) -static inline unsigned zone_span_seqbegin(struct zone *zone) -{ - return 0; -} -static inline int zone_span_seqretry(struct zone *zone, unsigned iv) -{ - return 0; -} -static inline void zone_span_writelock(struct zone *zone) {} -static inline void zone_span_writeunlock(struct zone *zone) {} -static inline void zone_seqlock_init(struct zone *zone) {} static inline void register_page_bootmem_info_node(struct pglist_data *pgdat) { diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 0d53eba1c383..29cd230a383c 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -528,18 +527,11 @@ struct zone { * * Locking rules: * - * zone_start_pfn and spanned_pages are protected by span_seqlock. - * It is a seqlock because it has to be read outside of zone->lock, - * and it is done in the main allocator path. But, it is written - * quite infrequently. - * - * The span_seq lock is declared along with zone->lock because it is - * frequently read in proximity to zone->lock. It's good to - * give them a chance of being in the same cacheline. - * - * Write access to present_pages at runtime should be protected by - * mem_hotplug_begin/end(). Any reader who can't tolerant drift of - * present_pages should get_online_mems() to get a stable value. + * Besides system initialization functions, memory-hotplug is the only + * user that can change zone's {spanned,present} pages at runtime, and + * it does so by holding the mem_hotplug_lock lock. Any readers who + * can't tolerate drift values should use {get,put}_online_mems to get + * a stable value. */ atomic_long_t managed_pages; unsigned long spanned_pages; @@ -559,11 +551,6 @@ struct zone { unsigned long nr_isolate_pageblock; #endif -#ifdef CONFIG_MEMORY_HOTPLUG - /* see spanned/present_pages for more description */ - seqlock_t span_seqlock; -#endif - int initialized; /* Write-intensive fields used from the page allocator */ diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 70620d0dd923..62d5dc2c01de 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -445,7 +445,6 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn, unsigned long pfn; int nid = zone_to_nid(zone); - zone_span_writelock(zone); if (zone->zone_start_pfn == start_pfn) { /* * If the section is smallest section in the zone, it need @@ -478,7 +477,6 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn, zone->spanned_pages = 0; } } - zone_span_writeunlock(zone); } static void update_pgdat_span(struct pglist_data *pgdat) @@ -515,7 +513,7 @@ void __ref remove_pfn_range_from_zone(struct zone *zone, { const unsigned long end_pfn = start_pfn + nr_pages; struct pglist_data *pgdat = zone->zone_pgdat; - unsigned long pfn, cur_nr_pages, flags; + unsigned long pfn, cur_nr_pages; /* Poison struct pages because they are now uninitialized again. */ for (pfn = start_pfn; pfn < end_pfn; pfn += cur_nr_pages) { @@ -540,10 +538,8 @@ void __ref remove_pfn_range_from_zone(struct zone *zone, clear_zone_contiguous(zone); - pgdat_resize_lock(zone->zone_pgdat, &flags); shrink_zone_span(zone, start_pfn, start_pfn + nr_pages); update_pgdat_span(pgdat); - pgdat_resize_unlock(zone->zone_pgdat, &flags); set_zone_contiguous(zone); } @@ -750,19 +746,13 @@ void __ref move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn, { struct pglist_data *pgdat = zone->zone_pgdat; int nid = pgdat->node_id; - unsigned long flags; clear_zone_contiguous(zone); - /* TODO Huh pgdat is irqsave while zone is not. It used to be like that before */ - pgdat_resize_lock(pgdat, &flags); - zone_span_writelock(zone); if (zone_is_empty(zone)) init_currently_empty_zone(zone, start_pfn, nr_pages); resize_zone_range(zone, start_pfn, nr_pages); - zone_span_writeunlock(zone); resize_pgdat_range(pgdat, start_pfn, nr_pages); - pgdat_resize_unlock(pgdat, &flags); /* * Subsection population requires care in pfn_to_online_page(). @@ -852,12 +842,8 @@ struct zone *zone_for_pfn_range(int online_type, int nid, unsigned start_pfn, */ void adjust_present_page_count(struct zone *zone, long nr_pages) { - unsigned long flags; - zone->present_pages += nr_pages; - pgdat_resize_lock(zone->zone_pgdat, &flags); zone->zone_pgdat->node_present_pages += nr_pages; - pgdat_resize_unlock(zone->zone_pgdat, &flags); } int mhp_init_memmap_on_memory(unsigned long pfn, unsigned long nr_pages, diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 296cb00802b4..27483245384c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7156,7 +7156,6 @@ static void __meminit zone_init_internals(struct zone *zone, enum zone_type idx, zone->name = zone_names[idx]; zone->zone_pgdat = NODE_DATA(nid); spin_lock_init(&zone->lock); - zone_seqlock_init(zone); zone_pcp_init(zone); } From patchwork Wed Jun 2 09:14:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 12295089 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 DB0EFC4708F for ; Wed, 2 Jun 2021 15:18:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 91456613FF for ; Wed, 2 Jun 2021 15:18:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 91456613FF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0979F6B0089; Wed, 2 Jun 2021 11:18:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 01F8E6B0088; Wed, 2 Jun 2021 11:18:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1B636B008C; Wed, 2 Jun 2021 11:18:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0235.hostedemail.com [216.40.44.235]) by kanga.kvack.org (Postfix) with ESMTP id A4AFF6B0088 for ; Wed, 2 Jun 2021 11:18:32 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 41FC0181AC9BF for ; Wed, 2 Jun 2021 15:18:32 +0000 (UTC) X-FDA: 78209140464.27.F878925 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf16.hostedemail.com (Postfix) with ESMTP id 2075C801937E for ; Wed, 2 Jun 2021 15:18:19 +0000 (UTC) Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A107022DF8; Wed, 2 Jun 2021 15:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622647110; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=9PGunXTcA2aMR3u/oDIIHMBR3qsGadtV3/P/9ZHHFPE=; b=VQ4uTVg54lQHpiSy7YTWRl8o4+oGVDHVxSzjplkZ9cm5M1wL56pQsZiNzbCTTPK0U4aEwT /bne6SyV9I13mZXGtZTDcAn9QdmA9/p9+7miqhGk534PWAI8QX3aU6jUl0aqCUQE/oKFZA LovF6h33gC30gNvS6xLIbZNWRoL+LgA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622647110; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=9PGunXTcA2aMR3u/oDIIHMBR3qsGadtV3/P/9ZHHFPE=; b=cGUBQ9X9qjs9y97+yeVL6GixfgImpFj+j0XZ9mF8LncVt4a3VJyondrYkHTIvpINAPRg12 eLCetlPLEavntvCw== Received: by imap.suse.de (Postfix, from userid 51) id 9A9B311CD8; Wed, 2 Jun 2021 15:28:32 +0000 (UTC) Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id A773111D1F; Wed, 2 Jun 2021 09:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622625311; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=9PGunXTcA2aMR3u/oDIIHMBR3qsGadtV3/P/9ZHHFPE=; b=gHo9waZztSQ4cdcNNm9TAYFEpbYwYEQJ/7uzFxKphCHfESuuL6qYD7bcHPaO3UdL/AkNCV l0tYCFQH5YRyN9jPwZGQLQDin+DPhZbYZKs+EgsXP7iLDcIrP7N5eX/dyplYv358pEFa/o /N97fpsQO4wszZUd4bStcuckVKhxANc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622625311; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=9PGunXTcA2aMR3u/oDIIHMBR3qsGadtV3/P/9ZHHFPE=; b=fP+vbG45AtHaXcrp9A2R0Ref8J+lkHsP1LOMBDKfw3RvFs/NOu6BBAt868Jbw6meiEg6E/ 3KxbwIs0D14L5EBQ== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id GBqUJR5Mt2A6HgAALh3uQQ (envelope-from ); Wed, 02 Jun 2021 09:15:10 +0000 From: Oscar Salvador To: Andrew Morton Cc: David Hildenbrand , Dave Hansen , Michal Hocko , Anshuman Khandual , Vlastimil Babka , Pavel Tatashin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [PATCH v2 3/3] mm,memory_hotplug: Remove unneeded declarations Date: Wed, 2 Jun 2021 11:14:57 +0200 Message-Id: <20210602091457.17772-4-osalvador@suse.de> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20210602091457.17772-1-osalvador@suse.de> References: <20210602091457.17772-1-osalvador@suse.de> Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=VQ4uTVg5; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=cGUBQ9X9; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=gHo9waZz; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=fP+vbG45; dmarc=none; spf=pass (imf16.hostedemail.com: domain of osalvador@suse.de designates 195.135.220.28 as permitted sender) smtp.mailfrom=osalvador@suse.de X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 2075C801937E X-Stat-Signature: h7sjqzy7mqjuxiwk5um4fubqipcp3qwa X-HE-Tag: 1622647099-250824 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: include/linux/memory_hotplug.h has the following declarations: extern int zone_grow_free_lists(struct zone *zone, unsigned long new_nr_pages); extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages); extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); These declarations were added by the following commit: commit 3947be1969a9ce455ec30f60ef51efb10e4323d1 Author: Dave Hansen Date: Sat Oct 29 18:16:54 2005 -0700 [PATCH] memory hotplug: sysfs and add/remove functions It seems that zone_grow_free_lists() and zone_grow_waitqueues() were never used, and add_one_highpage() was always declared as static in arch/i386/mm/init.c and later on in arch/x86/mm/init_32.c, and was later removed in: commit 5e7ccf8635c93b493f7d378a57ce300fbe1484e8 Author: Jiang Liu Date: Mon Apr 29 15:07:12 2013 -0700 mm/x86: use free_highmem_page() to free highmem pages into buddy system So remove these declarations. Signed-off-by: Oscar Salvador Reviewed-by: David Hildenbrand --- include/linux/memory_hotplug.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 0d837ce6ec11..9a19e97d4f1a 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -80,9 +80,6 @@ struct range mhp_get_pluggable_range(bool need_mapping); /* * Zone resizing functions */ -extern int zone_grow_free_lists(struct zone *zone, unsigned long new_nr_pages); -extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages); -extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); extern void adjust_present_page_count(struct zone *zone, long nr_pages); /* VM interface that may be used by firmware interface */ extern int mhp_init_memmap_on_memory(unsigned long pfn, unsigned long nr_pages,