From: SeongJae Park <sj@kernel.org>
To: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: SeongJae Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Muchun Song <muchun.song@linux.dev>,
Oscar Salvador <osalvador@suse.de>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 2/3] mm/hugetlb: Remove unnecessary if condition
Date: Thu, 15 Jan 2026 17:39:39 -0800 [thread overview]
Message-ID: <20260116013940.71199-1-sj@kernel.org> (raw)
In-Reply-To: <20260115181438.223620-3-joshua.hahnjy@gmail.com>
On Thu, 15 Jan 2026 13:14:36 -0500 Joshua Hahn <joshua.hahnjy@gmail.com> wrote:
> if (map_chg) is always true, since it is nested in another if statement
> which checks for it already. Remove the check and un-indent for readability.
>
> if (unlikely(map_chg == MAP_CHG_NEEDED && retval == 0)) {
> ...
>
> if (map_chg) {
> ...
> }
> }
>
> No functional change intended.
>
> Signed-off-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
> ---
> mm/hugetlb.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 88b9e997c9da..432a5054ca1d 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -3019,13 +3019,11 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma,
>
> rsv_adjust = hugepage_subpool_put_pages(spool, 1);
> hugetlb_acct_memory(h, -rsv_adjust);
> - if (map_chg) {
> - spin_lock_irq(&hugetlb_lock);
> - hugetlb_cgroup_uncharge_folio_rsvd(
> - hstate_index(h), pages_per_huge_page(h),
> - folio);
> - spin_unlock_irq(&hugetlb_lock);
> - }
> + spin_lock_irq(&hugetlb_lock);
> + hugetlb_cgroup_uncharge_folio_rsvd(
> + hstate_index(h), pages_per_huge_page(h),
> + folio);
Nit. Good chance to reduce one more line by putting 'folio' on the upper line?
> + spin_unlock_irq(&hugetlb_lock);
> }
> }
>
> --
> 2.47.3
Thanks,
SJ
next prev parent reply other threads:[~2026-01-16 1:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 18:14 [PATCH 0/3] mm/hugetlb: A fix and some cleanups Joshua Hahn
2026-01-15 18:14 ` [PATCH 1/3] mm/hugetlb: Restore failed global reservations to subpool Joshua Hahn
2026-01-15 19:19 ` Andrew Morton
2026-01-15 19:45 ` Joshua Hahn
2026-01-15 18:14 ` [PATCH 2/3] mm/hugetlb: Remove unnecessary if condition Joshua Hahn
2026-01-15 20:14 ` David Hildenbrand (Red Hat)
2026-01-15 21:10 ` Joshua Hahn
2026-01-15 21:59 ` Andrew Morton
2026-01-15 22:04 ` Joshua Hahn
2026-01-16 1:39 ` SeongJae Park [this message]
2026-01-16 16:45 ` Joshua Hahn
2026-01-15 18:14 ` [PATCH 3/3] mm/hugetlb: Enforce brace style Joshua Hahn
2026-01-15 20:10 ` David Hildenbrand (Red Hat)
2026-01-15 21:14 ` Joshua Hahn
2026-01-15 21:16 ` David Hildenbrand (Red Hat)
2026-01-16 1:54 ` SeongJae Park
2026-01-15 21:57 ` Andrew Morton
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=20260116013940.71199-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.