From mboxrd@z Thu Jan 1 00:00:00 1970 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 DA0A3C433EF for ; Mon, 30 May 2022 09:03:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0C19F6B0071; Mon, 30 May 2022 05:03:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0713F6B0072; Mon, 30 May 2022 05:03:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E9CB36B0073; Mon, 30 May 2022 05:03:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D7A0C6B0071 for ; Mon, 30 May 2022 05:03:21 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9A0D835162 for ; Mon, 30 May 2022 09:03:21 +0000 (UTC) X-FDA: 79521820602.22.C0816B7 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf15.hostedemail.com (Postfix) with ESMTP id 0B23BA003D for ; Mon, 30 May 2022 09:02:58 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 05DBC113E; Mon, 30 May 2022 02:03:20 -0700 (PDT) Received: from [10.163.36.153] (unknown [10.163.36.153]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B98243F73D; Mon, 30 May 2022 02:03:17 -0700 (PDT) Message-ID: <6676b6a4-2d2d-27bf-2f71-b0c4767b71bf@arm.com> Date: Mon, 30 May 2022 14:33:18 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH V2] mm/memory_hotplug: Drop 'reason' argument from check_pfn_span() Content-Language: en-US To: David Hildenbrand , linux-mm@kvack.org Cc: Oscar Salvador , Andrew Morton , linux-kernel@vger.kernel.org References: <20220526021258.4030749-1-anshuman.khandual@arm.com> <8c5c5bd6-fea6-4c27-9a84-4b9c937068d7@redhat.com> From: Anshuman Khandual In-Reply-To: <8c5c5bd6-fea6-4c27-9a84-4b9c937068d7@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 0B23BA003D X-Rspam-User: X-Stat-Signature: pqi1c796gip6gbnjnnjotwoiycqxdi9q Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com X-HE-Tag: 1653901378-837487 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: On 5/30/22 12:24, David Hildenbrand wrote: > On 26.05.22 04:12, Anshuman Khandual wrote: >> In check_pfn_span(), a 'reason' string is being used to recreate the caller >> function name, while printing the warning message. It is really unnecessary >> as the warning message could just be printed inside the caller depending on >> the return code. Currently there are just two callers for check_pfn_span() >> i.e __add_pages() and __remove_pages(). Let's clean this up. >> >> Cc: Oscar Salvador >> Cc: David Hildenbrand >> Cc: Andrew Morton >> Cc: linux-mm@kvack.org >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual >> --- >> Changes in V2: >> >> - Fixed typo in commit message >> - Dropped using 'ret' to capture check_pfn_span() return value in __add_pages() >> >> Changes in V1: >> >> https://lore.kernel.org/all/20220525033910.3781764-1-anshuman.khandual@arm.com/ >> >> mm/memory_hotplug.c | 20 +++++++++----------- >> 1 file changed, 9 insertions(+), 11 deletions(-) >> >> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c >> index 416b38ca8def..3b24386e9276 100644 >> --- a/mm/memory_hotplug.c >> +++ b/mm/memory_hotplug.c >> @@ -220,8 +220,7 @@ static void release_memory_resource(struct resource *res) >> kfree(res); >> } >> >> -static int check_pfn_span(unsigned long pfn, unsigned long nr_pages, >> - const char *reason) >> +static int check_pfn_span(unsigned long pfn, unsigned long nr_pages) >> { >> /* >> * Disallow all operations smaller than a sub-section and only >> @@ -238,12 +237,8 @@ static int check_pfn_span(unsigned long pfn, unsigned long nr_pages, >> min_align = PAGES_PER_SUBSECTION; >> else >> min_align = PAGES_PER_SECTION; >> - if (!IS_ALIGNED(pfn, min_align) >> - || !IS_ALIGNED(nr_pages, min_align)) { >> - WARN(1, "Misaligned __%s_pages start: %#lx end: #%lx\n", >> - reason, pfn, pfn + nr_pages - 1); >> + if (!IS_ALIGNED(pfn, min_align) || !IS_ALIGNED(nr_pages, min_align)) > We could do > > if (!IS_ALIGNED(pfn | nr_pages, min_align)) Sure, will change it.