From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFDCF334372 for ; Fri, 16 Jan 2026 01:39:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768527589; cv=none; b=fWbL7qPzMbjpGvem1MMgtovc9TqOzBC4zSIj/wMM/lvTcnZ02FNg0x2hgLFwys7Rvu9egtOOjH1RwmRWxCkVYhHjtk3XHWI/ARWJiQHRBSZDa5czf6geiyFHtJMj8KKTX8i/Z3EAjlOnvu58k0Hu1+vdCEmZq7mT6SEOJXs9byY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768527589; c=relaxed/simple; bh=82eNo2ktX6tFblTMXptqgcZVGgL/M43Bb4N1IqpG96U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HFv/a6G7rEsJVRJYcAeJ283fszfIH2zw3JXzq+7DKGC1iy5h1mlSAEEgSq+nwFaQ7flcIEi2DJzgTxUQ9ZfG7e9277WjjxhaJ2xzmY76QjJMipHsGrEOrcijw+xRazPBkZNAxdQfafLKeh/aBOWP+4TUg4IbaWH5VcSjTu0cBmo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IO46qOxp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IO46qOxp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31EDFC116D0; Fri, 16 Jan 2026 01:39:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768527587; bh=82eNo2ktX6tFblTMXptqgcZVGgL/M43Bb4N1IqpG96U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IO46qOxpPTKW3OjU/Ekhv9YjvIsBitQhXx3/seRIzjz1YcrjQ8AiCpO6gXhXcV5X2 q+DLVYchsL69T4G9dAknQ5KfYuIgMr8oUXPuxkm9kU5ADKf1bU8gXkVNovkkcSq0uT sjoW8ZTnlMJIn6VS4RZ5BeHkIkpAgdpxuzi96Zx+pKOc0+EVuFpZeS47a+9RGivKiL Oa8DwmgPl4+tXehH6K1RzkHLchxlsI34Nr5BAKiJgC/q2NkB0wS8beYuGXRULqvSZm d3X3tBbDtRJUofSPCxtwkd0LMk9YmKAPXQJqtuj9nz2Pjt3hUScIQJQgLOui2qNx99 n25Pr77VJbNJA== From: SeongJae Park To: Joshua Hahn Cc: SeongJae Park , Andrew Morton , David Hildenbrand , Muchun Song , Oscar Salvador , 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 Message-ID: <20260116013940.71199-1-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260115181438.223620-3-joshua.hahnjy@gmail.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Thu, 15 Jan 2026 13:14:36 -0500 Joshua Hahn 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 Reviewed-by: SeongJae Park > --- > 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