linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>, linux-mm@kvack.org
Cc: Oscar Salvador <osalvador@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] mm/memory_hotplug: Drop 'reason' argument from check_pfn_span()
Date: Mon, 30 May 2022 08:54:53 +0200	[thread overview]
Message-ID: <8c5c5bd6-fea6-4c27-9a84-4b9c937068d7@redhat.com> (raw)
In-Reply-To: <20220526021258.4030749-1-anshuman.khandual@arm.com>

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 <osalvador@suse.de>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> 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))


Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



  parent reply	other threads:[~2022-05-30  6:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-26  2:12 [PATCH V2] mm/memory_hotplug: Drop 'reason' argument from check_pfn_span() Anshuman Khandual
2022-05-30  5:03 ` Oscar Salvador
2022-05-30  6:54 ` David Hildenbrand [this message]
2022-05-30  9:03   ` Anshuman Khandual

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c5c5bd6-fea6-4c27-9a84-4b9c937068d7@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).