Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp134603rwd; Tue, 6 Jun 2023 20:02:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4LXmentGN9ygg/JSwOAmxSkwpE2AgpmM51pN5Iv6tGKtb+R5GV1jkKPWEe3sC3TmACZ7DO X-Received: by 2002:a05:6a20:a5a9:b0:10e:d134:d686 with SMTP id bc41-20020a056a20a5a900b0010ed134d686mr1752777pzb.6.1686106928991; Tue, 06 Jun 2023 20:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686106928; cv=none; d=google.com; s=arc-20160816; b=F2MLnKLDJnXZooz2Q8+fX1huAtQrAEoKOhAxRAKRIpKVkthDMua8zoDg4b6vlBlobO 0acR0ZWCB/5OEOUHRLpq4G50bGRjjXl5GKzuVic96TUJHxIaKyFnJ0qbk0YF2ucvUSTO 2GzmM5WTo04vPyZNQrHEJLdBmAfadmTKKFhNJcdCBPg5qc7Rj3sGmuWVjbnEQT9VzSan SWhd6tFZTpaC/E7umt/FMMzRKhfgI7t1wsYTvYO+WgFbZonfNRokNmQPONq0tYeCEP6G qguF8jlQ1u3UK1os5GDjttpzBpb4w2PKju5N83bg+v1DjemKZKPpoWc1t3dwxWSW0t4W UHmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sqUILCp46Jj47kiEIO7DRVGvfhl8JWDw877OJqEVvRU=; b=rgUW45b01UEGNmygj7YmHkgvjMNRzJd3GPsDW9S76WZgwlYM5xL9IEFSCNiWizkaPj OzVMlg2R+COgpL1NFxVEb+54gWNV2aM0YE59V2TbechfN8JQRmXl3hmNxxABHUeS82GX 7qMtdskTcvvyP4Ub/PwJbekyBidg1LdwEPhFjpCorwCw9jIQWtS2TEZGVIP0DUCjnNtD zcQ9NGbRSlS6oYB7QUUZvOjo8IMBWD6/h5ojt9ezW25pjXnx+I/R6tcylnzpJoWPOCG9 hPzhL3m0iljUAvxyDml4gcm/2y9VkboeaHedt/XPSZ9+9jwvmgWI+uWYe7RnKfKOk/YG 66Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=vwIe7yWn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v71-20020a63894a000000b00542c0357ee6si7173619pgd.814.2023.06.06.20.01.56; Tue, 06 Jun 2023 20:02:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=vwIe7yWn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240660AbjFGCkP (ORCPT + 99 others); Tue, 6 Jun 2023 22:40:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240771AbjFGCkM (ORCPT ); Tue, 6 Jun 2023 22:40:12 -0400 Received: from out-8.mta0.migadu.com (out-8.mta0.migadu.com [91.218.175.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BE441990 for ; Tue, 6 Jun 2023 19:40:10 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1686105608; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=sqUILCp46Jj47kiEIO7DRVGvfhl8JWDw877OJqEVvRU=; b=vwIe7yWn2mHkbKvWsHxQjHndMddY6TdIFGCmdPfxJ6Sz2JzzNt4B8wik8kvRuMZd9J/H3u 23Xp4QxF5UC1pTejMotjmvMDZNQXtziAaEMybqPV8N91l6zY8qlxt1ZOVv8WueKLQ+5Hho FhoqHpyRtf4loEK+nIT8Z6+vfqDrcxE= From: Yajun Deng To: akpm@linux-foundation.org, david@redhat.com, osalvador@suse.de Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yajun Deng Subject: [PATCH] mm/sparse: remove unused parameters in sparse_remove_section() Date: Wed, 7 Jun 2023 10:39:52 +0800 Message-Id: <20230607023952.2247489-1-yajun.deng@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These parameters ms and map_offset are not used in sparse_remove_section(), so remove them. The __remove_section() is only called by __remove_pages(), remove it. And put the WARN_ON_ONCE() in sparse_remove_section(). Signed-off-by: Yajun Deng --- include/linux/memory_hotplug.h | 5 ++--- mm/memory_hotplug.c | 18 +----------------- mm/sparse.c | 10 +++++++--- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 04bc286eed42..013c69753c91 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -344,9 +344,8 @@ extern void remove_pfn_range_from_zone(struct zone *zone, extern int sparse_add_section(int nid, unsigned long pfn, unsigned long nr_pages, struct vmem_altmap *altmap, struct dev_pagemap *pgmap); -extern void sparse_remove_section(struct mem_section *ms, - unsigned long pfn, unsigned long nr_pages, - unsigned long map_offset, struct vmem_altmap *altmap); +extern void sparse_remove_section(unsigned long pfn, unsigned long nr_pages, + struct vmem_altmap *altmap); extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map, unsigned long pnum); extern struct zone *zone_for_pfn_range(int online_type, int nid, diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 9061ac69b1b6..8877734b5f2f 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -492,18 +492,6 @@ void __ref remove_pfn_range_from_zone(struct zone *zone, set_zone_contiguous(zone); } -static void __remove_section(unsigned long pfn, unsigned long nr_pages, - unsigned long map_offset, - struct vmem_altmap *altmap) -{ - struct mem_section *ms = __pfn_to_section(pfn); - - if (WARN_ON_ONCE(!valid_section(ms))) - return; - - sparse_remove_section(ms, pfn, nr_pages, map_offset, altmap); -} - /** * __remove_pages() - remove sections of pages * @pfn: starting pageframe (must be aligned to start of a section) @@ -520,9 +508,6 @@ void __remove_pages(unsigned long pfn, unsigned long nr_pages, { const unsigned long end_pfn = pfn + nr_pages; unsigned long cur_nr_pages; - unsigned long map_offset = 0; - - map_offset = vmem_altmap_offset(altmap); if (check_pfn_span(pfn, nr_pages)) { WARN(1, "Misaligned %s start: %#lx end: %#lx\n", __func__, pfn, pfn + nr_pages - 1); @@ -534,8 +519,7 @@ void __remove_pages(unsigned long pfn, unsigned long nr_pages, /* Select all remaining pages up to the next section boundary */ cur_nr_pages = min(end_pfn - pfn, SECTION_ALIGN_UP(pfn + 1) - pfn); - __remove_section(pfn, cur_nr_pages, map_offset, altmap); - map_offset = 0; + sparse_remove_section(pfn, cur_nr_pages, altmap); } } diff --git a/mm/sparse.c b/mm/sparse.c index b8d5d58fe240..297a8b772e8d 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -922,10 +922,14 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn, return 0; } -void sparse_remove_section(struct mem_section *ms, unsigned long pfn, - unsigned long nr_pages, unsigned long map_offset, - struct vmem_altmap *altmap) +void sparse_remove_section(unsigned long pfn, unsigned long nr_pages, + struct vmem_altmap *altmap) { + struct mem_section *ms = __pfn_to_section(pfn); + + if (WARN_ON_ONCE(!valid_section(ms))) + return; + section_deactivate(pfn, nr_pages, altmap); } #endif /* CONFIG_MEMORY_HOTPLUG */ -- 2.25.1