From patchwork Wed Jun 19 01:06:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13703299 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28786C2BA18 for ; Wed, 19 Jun 2024 01:06:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 053336B0361; Tue, 18 Jun 2024 21:06:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 002656B0363; Tue, 18 Jun 2024 21:06:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF2436B0364; Tue, 18 Jun 2024 21:06:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B0C9E6B0361 for ; Tue, 18 Jun 2024 21:06:27 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 15D1DA151C for ; Wed, 19 Jun 2024 01:06:27 +0000 (UTC) X-FDA: 82245847614.09.7596D23 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by imf21.hostedemail.com (Postfix) with ESMTP id 6B3B61C0010 for ; Wed, 19 Jun 2024 01:06:25 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="hv/Y8AIT"; spf=pass (imf21.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.167.41 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718759175; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references:dkim-signature; bh=uNxYYQKq4nBGWdxowSvovRqaTORnXc/r6W1XqFHApm8=; b=5ygOTL5+jh3bd7HRFsBhiN5rPllUuoI24ZnftOjz8m9/77PLI7c3lIJ0Lgh0TgpNL8ZQ8m hNg+3ArjMZvdQ92nkRYV14u/i3zK0JxCp7RY0Bzo1w4lR0+ni8xfrxF3VGGMgEiY3o52O9 O/WGRjR5rLO7xXoJEfxpx+DiZMBwOk0= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="hv/Y8AIT"; spf=pass (imf21.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.167.41 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718759175; a=rsa-sha256; cv=none; b=Fnqg4xsMvnW4Ehez6a6OQbHYu0I1DMNObxQn1z9CCpm8dbKPbCmUFVmFAyK87tpDBkAsTW 6fxe3YxTlhkviIGFtcbXVUE6qGWDtOlI17XUf3m9EOlskWJkwuUjj4V7YwdQAWG5izUpvD iy5MrJEiU0aHfh6G2D3qa00IV+35M2E= Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-52bc27cfb14so7410602e87.0 for ; Tue, 18 Jun 2024 18:06:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718759183; x=1719363983; darn=kvack.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uNxYYQKq4nBGWdxowSvovRqaTORnXc/r6W1XqFHApm8=; b=hv/Y8AITzrVoVEMaBANXVE/pJ/HOs8kzej9gtYGk2fimW37nfMzAyrKjIDJxdIvoG8 FW4pz/Bjfx10qb5+cm3itXPlyFY+gPZkggeq7bmX7MpmRo7TboJJWBG2KceGaeJ5wBQY XBX4+H5pW4AhAS98HsT2qEmtft0wjK2YP6z5Wo4fI6g6lmHcSnAiR8uJ2cIcphc5UsrM Cj6a6P7Nl6UWa5RYlE+xWgfvBsc5r/7vj4GidqYC8FbREsT7Xfp/ihBzVWLEt/MtKSVi dfVybA37VrWSwhq0pRcoIZzXs3ipB4MxqJqBZ+4JiKV6X2p+flnWaROZgviIjmpG4jRj BrGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718759183; x=1719363983; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uNxYYQKq4nBGWdxowSvovRqaTORnXc/r6W1XqFHApm8=; b=BDj4lGuqlSJjpqa8sVWKDo76Cpu2rOXIvu8waU+FBWFl7giE8zqPk2HYNQoOr2BnTt NhvuFQQCZMI/0heJgMYuKl4S96XHiajGcvsSV1QA0b/DYRru3XRKCAmg2SyNu514lepg J6kSrhqQ2Dsr4vUQAQTTNw0wQ5G8f7TSezRxmE+BGUKPpFAh/xNABxu/gz+cDCDODf5W EFc2bLYawqW4bc/veVDhD7obupe1DdIIeRjFlLEu61KdM6ScLtPbLGSjCzzELBuvYlBr fdA6YXuqV/a77aVioUzkt/Vw5GlePxl32EZVSfP9Qirm6nmo2TR5Xv+KPygY80ueKwMT bXzA== X-Gm-Message-State: AOJu0Yxv1+KEzWWPehUZ+8+BHO7PW53Rh/ndLe9V0YAeoxjpKRTgXTz/ x8YulLYlfY+qyfK7NC00Rf96A9U1E3yrXlnV+ADlWfHA9fDqf4wc X-Google-Smtp-Source: AGHT+IEz7fcI4jWolKFLj3H0NfWKG62R/1Zxchw/kpmOd4M7/TQpL6gXQVmamS2n/HGRvSqpqEo2zA== X-Received: by 2002:a05:6512:3da3:b0:52b:c33a:aa7c with SMTP id 2adb3069b0e04-52ccaa599d0mr804820e87.65.1718759183341; Tue, 18 Jun 2024 18:06:23 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f8186b686sm301852666b.7.2024.06.18.18.06.22 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Jun 2024 18:06:22 -0700 (PDT) From: Wei Yang To: rppt@kernel.org, akpm@linux-foundation.org Cc: linux-mm@kvack.org, Wei Yang Subject: [PATCH 1/4] mm/sparse: nr_pages won't be 0 Date: Wed, 19 Jun 2024 01:06:09 +0000 Message-Id: <20240619010612.20740-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 6B3B61C0010 X-Stat-Signature: d119k38cxz394k1tpkgydyus6dykbhk1 X-Rspam-User: X-HE-Tag: 1718759185-798938 X-HE-Meta: U2FsdGVkX1/FzPa5cqbHk1pgvqsL5imuANJhDKZRvRbwmnoG8mpSFfchet3Gzm3RKnmNH9hIeqZwSjM8U78tJHe2kVdBKQ0KcmY/FPOLjK7v6q3KAfjCl1MXY2VEXoHYmkPR8wFw3qwtbP1uzwb8rvn2JMQDt/UAFr3Rhwu7Nt8twRSoiFTzFtHMr3dQkrb8/x/w/ErlCcypzIChRyOxnGt3CxFS7glodL/nWJTUj27XY1JhaeeUNJ8l/DAGUvRNDadba817GsWS/UwryBhP9f+1I2A2ArjjcV0Mti70o5Rj7vzluS1aBhvWV7+VbYXLu/mK7OE73ggFS/8SApRm61c4RC0V1SsoWkkSbTjMEGJl1LI3PQceGu8xszGaV4PV8d6LNKav3wgOmBXHBAnxooZVAg5mWEG+N6de0kYSOlqV/XrDlBcWeGtEuC8iMBfQkUQLZVCIAGWskikIuuRwaqwGhGspgUCcAIh6vWQl+N+yinCfxSijes/2Bf5nXrWNYAbtydqilKqE6BZ+l9uCxiye7KskCEjbFeTDFZjDzsfeT+5cg+4KEGh/Qki2ImY2TDUA3g3wZlJzNNjseKzmwq85T8EWD7KimJSn12tte5DnBOcfpY+pR33NNOwBf2TJTk0m4GhrWT+x3xyskKLlWiU09dMMVfuDNCDFRkOt5qQEehpm68/wD0MOULKOydiEZAXvKhae4yRc9ZB1uoGCl05fXaxUVgDthvxCrCOZ5MhhVWCB0IDFP0HYUUnewvW7rtw7R91YaCd+Hja7+q3bzAGOHzoqEztuv3rG6fX2L8wZ1YYcaIwIPYnFCuXtFawgB0r5+ZKOj3bafqS+f94kxGksnT3PhtcJmr671uM0ykF91g/Fd1hhkyY/ehEhmK1zUWRg9yTSpxh6IGUiGjXsBeb9AM/KeBiCdhDF/NCuaqdt2V8Py4MRSC5YEWnHs9k3olY6RRZJVhiLUbHrZQa RccWXMVO rDUOSESF4rG3xmBy8yDzE6bkFua/DYEg/LjEivKkQIhDIxxJtU2qw0cc+dcsD4b88sYJMpwF65AJavEyajcg1k6bI9zkw7CKhocUi4jfNW5utBim48qgBWaX2/aeitsZbPNqn/4siBvP1rlMDCgJpaHh3Z9w4QmYICcSB0vKTmBSY35+E+KsBz2T5327frrJQOOa4zfsuRJsGfHsKULcDwtoF+iuCDPRcl9Eiqzgj4fgoqEvfZ9x+lSUqq0bw4GegSuLRMBGlCn+/oi9ePMed1lSvYitO2iIGSWWWarkuEMQliEU/Llxw0pKpjMg3Kalp0ceDL7qyAd5Bji8F1DW4do4GEggnZJnmsdr0+PRlFg2E4j8RP4ucTybbRHbpPT3VIJc7BFJXgujC+wi9vms/mJJzVvhXZx/aHMuR9GX3YbMfyeLhY1l44IY83YwAnulp8khBJY7dS9v8pZntx3TwXeFSueRvGXo0ulNAu7Dpj7WR9zqu6srOkoheP4jYr40ipBIc1MiNPJwllVM= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000134, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Function subsection_map_init() is only used in free_area_init() in the loop of for_each_mem_pfn_range(). And we are sure in each iteration of for_each_mem_pfn_range(), start_pfn < end_pfn. So nr_pages is not possible to be 0 and we can remove the check. Signed-off-by: Wei Yang CC: Mike Rapoport (IBM) --- mm/sparse.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index de40b2c73406..f56701873ce8 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -195,9 +195,6 @@ void __init subsection_map_init(unsigned long pfn, unsigned long nr_pages) int end_sec = pfn_to_section_nr(pfn + nr_pages - 1); unsigned long nr, start_sec = pfn_to_section_nr(pfn); - if (!nr_pages) - return; - for (nr = start_sec; nr <= end_sec; nr++) { struct mem_section *ms; unsigned long pfns;