From nobody Sun Feb 8 18:32:06 2026 Received: from mail-yx1-f48.google.com (mail-yx1-f48.google.com [74.125.224.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F11D53E0B for ; Thu, 15 Jan 2026 18:14:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768500885; cv=none; b=U2o99gIhgNlGfInelfkI7cypp4RB+FDiKTNDEmq3hUyT3glFQMtBqT2CjRH7GgSpe2xEotd845FSZfDdr/fzfCZx87ohVqrfonktxwC6ZXVmNz8PLX+JvdipiaDm0V2WhgIWof+vtQ8kdcMaP66oxUVg4PfnKYanyh8Yo+jIfUU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768500885; c=relaxed/simple; bh=PREq6X5dQOSijb3j/ArhlfPtqTgBVODvVTzNWDj0g6k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GcUyC/qa10cShD67NFISzzus1fyLuEsZJWILKPhvAJHB8xVXhdtc2xVSrJrA3XXeINGnd/6mvFKo2vJFMC7V38c0DQwr+k+yMFrpp3cvB0jCDE7AIwV+Dy3WeYIopjkj0hQ1hu5QBraovTYKGH96jd3g0CAgwfechuWrpNcY054= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=a8vmqupj; arc=none smtp.client-ip=74.125.224.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a8vmqupj" Received: by mail-yx1-f48.google.com with SMTP id 956f58d0204a3-6466d8fd383so1146089d50.2 for ; Thu, 15 Jan 2026 10:14:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768500882; x=1769105682; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=O45eLppLOCW6F7IMGZ1ULnrc2pXJxucNBG4tS3sUSSc=; b=a8vmqupjyGIDJlTY507dJkMjzIUVbErDhw3jbY26KNZAheovldgoxv3L+KdZOsVReo K1rlcFtOlI43v88vXKgpNfQPoTEizva0+EDP9Eej5WqVjVMn8aIa1NPL4Y3J3jGx1tzp BlBXNnuk9Hl4/1ig+yuXnxpST7JiM+37MluLX/0rZfslqIt1+lAu39AgseOSAriwAw6B pe5ji1DBhWW23VwbO+YeMnyilevkdk1mBdqnnXsVV3skZpsghpzfIqZS6FNR0q5Kdm8h dPK0Xy5E7PhdmDDm8144GB12TxppcESy69YjlD1x2c81sobru2Vi3hx/LNr+cSqvVKik JDLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768500882; x=1769105682; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=O45eLppLOCW6F7IMGZ1ULnrc2pXJxucNBG4tS3sUSSc=; b=RFe1c+xj3wrhiuKc/QUEBm1hJCmAD9nsmGBsEVV1rp5ao7eYC6jbbcgAbMQ7gwX12y sNqCMQWsNg6aQBpXw771u5tEdqM48cAaRhTUFGBtojJ9SsyVaeLWMWsVK53Th2U10wFP nvjx0ZOUc6gTiOSNhhZspqQjSVNt+d4ZYP8ynqPqh2os/SSDQz9tJP86xyjZeeOy9wQV OnMcguLRdHCqzPlLdvqak9wUhMX//zV9Pl0ztGhTpams6AUO7eQisojAD5P17iEa8DYS w18zjPuOJGZptcDbg9cAh7yG5Pfnzn2T6E+WZOCtIoW0Vv+/6DmO42Ye+a0ww+qB8f5H 57Wg== X-Forwarded-Encrypted: i=1; AJvYcCVzSjdqGQF2aYb3tTp7lz0QCGLakMhKAfNPo8GJeFy0q49JDiFPpAjngCxs+bPFHb7pMg9HVc46485Ty5A=@vger.kernel.org X-Gm-Message-State: AOJu0YxZUsvMJyYpeLYIpcYsWgFbv2/eU20lj0p0Tiz50QD6KdU/rolb HlNX2S43U+as6qpLwnL00X6MPNCJ8cx6Sr+MVAwb23NrZmLxiSu+KLObg/O7yw== X-Gm-Gg: AY/fxX4jq/ymRAcsp7nAdBJQKFLHYArVZzZIbBfw5K/o62k0PcPHhI/zdSDfkb9WMlM CMxbkfm7By07wIilKxRZxclEBTrK6Bs260rKtmZKuSa4BJtUpD0mT9fBFd9kd3JEtfBJqPnIPCf FxWqYb6pkUCjRoEZIuu3UUd7M3hvL+AN8NjR9AOV1cEajSID0+8INAiDXljAoFJF/INYD7YRMHO qYI+o2m95XUJBllbo3yXI+q3rKz6RwkPrvvjidygsfecdhoGt9zBN6Q6iXVri7zLUkX5zBUElAm pNMj+wg32Sd4jTfwTGgna7V0nejAho+h/Z9iAbgTVMo99DTU2wjewWWwRaZbcFlHzgRW6FzDIAT wM4UusRzGr8F2nn1ke5Y9mgrzRSngXtnzszKj6AHm1JCNadk6nGyfdZG3EvlEQrtzpNTR4J9lRR fYOGh0JD7g7c0MlyI/iPji X-Received: by 2002:a05:690e:b46:b0:63f:b634:4224 with SMTP id 956f58d0204a3-64916484f7bmr462440d50.21.1768500881797; Thu, 15 Jan 2026 10:14:41 -0800 (PST) Received: from localhost ([2a03:2880:25ff:44::]) by smtp.gmail.com with ESMTPSA id 00721157ae682-793c68307b5sm98567b3.32.2026.01.15.10.14.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jan 2026 10:14:41 -0800 (PST) From: Joshua Hahn To: Andrew Morton Cc: David Hildenbrand , Muchun Song , Oscar Salvador , Wupeng Ma , linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-team@meta.com, stable@vger.kernel.org Subject: [PATCH 1/3] mm/hugetlb: Restore failed global reservations to subpool Date: Thu, 15 Jan 2026 13:14:35 -0500 Message-ID: <20260115181438.223620-2-joshua.hahnjy@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260115181438.223620-1-joshua.hahnjy@gmail.com> References: <20260115181438.223620-1-joshua.hahnjy@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Commit a833a693a490 ("mm: hugetlb: fix incorrect fallback for subpool") fixed an underflow error for hstate->resv_huge_pages caused by incorrectly attributing globally requested pages to the subpool's reservation. Unfortunately, this fix also introduced the opposite problem, which would leave spool->used_hpages elevated if the globally requested pages could not be acquired. This is because while a subpool's reserve pages only accounts for what is requested and allocated from the subpool, its "used" counter keeps track of what is consumed in total, both from the subpool and globally. Thus, we need to adjust spool->used_hpages in the other direction, and make sure that globally requested pages are uncharged from the subpool's used counter. Each failed allocation attempt increments the used_hpages counter by how many pages were requested from the global pool. Ultimately, this renders the subpool unusable, as used_hpages approaches the max limit. The issue can be reproduced as follows: 1. Allocate 4 hugetlb pages 2. Create a hugetlb mount with max=3D4, min=3D2 3. Consume 2 pages globally 4. Request 3 pages from the subpool (2 from subpool + 1 from global) 4.1 hugepage_subpool_get_pages(spool, 3) succeeds. used_hpages +=3D 3 4.2 hugetlb_acct_memory(h, 1) fails: no global pages left used_hpages -=3D 2 5. Subpool now has used_hpages =3D 1, despite not being able to successfully allocate any hugepages. It believes it can now only allocate 3 more hugepages, not 4. Repeating this process will ultimately render the subpool unable to allocate any hugepages, since it believes that it is using the maximum number of hugepages that the subpool has been allotted. The underflow issue that commit a833a693a490 fixes still remains fixed as well. Fixes: a833a693a490 ("mm: hugetlb: fix incorrect fallback for subpool") Signed-off-by: Joshua Hahn Cc: stable@vger.kernel.org --- mm/hugetlb.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 2e296d30a8d7..88b9e997c9da 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6560,6 +6560,7 @@ long hugetlb_reserve_pages(struct inode *inode, struct resv_map *resv_map; struct hugetlb_cgroup *h_cg =3D NULL; long gbl_reserve, regions_needed =3D 0; + unsigned long flags; int err; =20 /* This should never happen */ @@ -6704,6 +6705,13 @@ long hugetlb_reserve_pages(struct inode *inode, */ hugetlb_acct_memory(h, -gbl_resv); } + /* Restore used_hpages for pages that failed global reservation */ + if (gbl_reserve && spool) { + spin_lock_irqsave(&spool->lock, flags); + if (spool->max_hpages !=3D -1) + spool->used_hpages -=3D gbl_reserve; + unlock_or_release_subpool(spool, flags); + } out_uncharge_cgroup: hugetlb_cgroup_uncharge_cgroup_rsvd(hstate_index(h), chg * pages_per_huge_page(h), h_cg); --=20 2.47.3 From nobody Sun Feb 8 18:32:06 2026 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 313923C198E for ; Thu, 15 Jan 2026 18:14:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768500885; cv=none; b=nVoRGZNmNgDjr+iLfzWHikTpBUgON1U7giuE7xQe9iAYkR8w/pHYyRYzjq2rChk0GxExiMc1Vb4oH1gOUfrqe1thXdLMElyKPGRov7FM8JPqIw4KqlDDsfLS0tFAb7ef+Cngzl3AajFlPvxKXlQxDbfkzbm2IXIVg/yy22Dr2QM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768500885; c=relaxed/simple; bh=LzRPZjYTn14TUdyU+riMBqe259RejDqvfONwi1Pg3LM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Wa2HrkksOV0yL66dHU0M3JQ5yFF57SV74apGFaebk5201Q3tnGUnBQgRGIzV6TxzsDFHKeTHkRRT71PR2pDnlKVHuFe3JYZ78/DgBN9SsUzUrm/cSAR460CFeScG4BEmEHh+FoZZWCPY6C2+xF67SRU3+qecznCsYM5B6eTZL/k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YwDPQKcn; arc=none smtp.client-ip=209.85.128.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YwDPQKcn" Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-792815157f3so12684937b3.1 for ; Thu, 15 Jan 2026 10:14:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768500883; x=1769105683; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Fl1lTXpbNrtiLn0Tp+FPt+QeDg7+SN/+cxlb4rbkB8w=; b=YwDPQKcnmdO4kiZvD5XDA56MWE4gQzsMOkpBeGXukIzX5Wqpqrgj8OoFiWA2hOivGb 9qggbRS1/nOey6UOOa/2hqsVzTFWuSQw2RWUWjGP2kKyzgYw7IN63Kgu0mjo66/jd+m0 LXGynjEbrmhzSlsIMRT/yu1TzcV4vim/67HKbJIV6ibTVQUCZ0IPJJlXID0jzJM1YaAB lLeolxUNpLMVHBzwChNqPaUkZB89SNfgiBj7pz1c0Jz23elWULYYKX64tp3JH3XngaZg IKIsFIeldzbIQBpHCSmB/Ut88jHFqgULZGDkjXTclc+yk9pqP/Sm44YWYiHfgVlGSUs8 7GMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768500883; x=1769105683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Fl1lTXpbNrtiLn0Tp+FPt+QeDg7+SN/+cxlb4rbkB8w=; b=g7dv4O0XXAbZMkk/GscUi/KodYUSHIiXumXVGq0fFSBGWPLzVnYPnjHiGh7uPOEASb bsLQI3eGbJzB4+3wSLMoYVAAtmeRi6YJAhi5u+NimcopUS2Sjo2OjwIcc5DfNSfaEuEP gG+PngCycP1D7gYJfz329RblKlOw0zmgdxXiEQ6MRCx63Nry2SZn/4Fd9fWNECz6T9R7 Z6uQiXK30OflVbZ4tBI4kLi4q45tVxhuT65+K/FrHFzV2rd8YLjag5W+pp7TzctIoJkK nrGo5nH5u2HW3SYnPW+P2pfydIz8vKMPiR2lYoyGUu31O+7th10ZAXZsLJOL1FYwj9Jb Bcxw== X-Forwarded-Encrypted: i=1; AJvYcCUde8iJmVARMg9oOgTsjgafE6jiA8MCEaB4cWbfA6TkUobUReqygBTea4/W2Q47TPR9IklEfhleV0zINbI=@vger.kernel.org X-Gm-Message-State: AOJu0Yx7Z9Iye4BQE0tr0CkdnQ9DTpsAly2RIVkrMQQP7842pAcgWYVw AsZrw++nak/HjdrV+Elhm0YLqqZk2Qa+nPhG5Ixtx8hBGasu1HUqAlsJ X-Gm-Gg: AY/fxX4LC9jx/nHQv5C+GY9ADGsmzZ6V0ZCCRvMuQ14VzixRlDIBWZN1oWQEeUjMl95 pklvaHWbJLQYgqe17LFHXUPyMirN6CzALXf6QHnXAsMcY/FRcl5ZVXnJz2IRcpuY6MedcFPUqH9 H1rPkxHsNBRgH6xd2J/m3VdJQ2pCyfiooZWFjCw1B8TZlC17IhwGUWUEUpRBi9jpNc7P7/j/X2p esoVo/LRJe9wxaKLYIXDvrt18hUqy0hroYG0crAphM6+JVhZIPKftC7XjtPBK/uB8OjIl85cQZ4 eZsSU2xaLjUnhbMPvGvtoIzSlFAeiSGynWMgVtOT7MeRIRxql/OEVKg68GcKlGJqcKiAcrFPRib iyHQmguFYa6KHkObtm3TKl6SxcMkS6dSDXDH/n0E5m0z04OVQ8c6ZeGizIXNqh6PDRRtKXy/k/j Z1bySy3XFMqg== X-Received: by 2002:a05:690c:39d:b0:78c:fd6:6c11 with SMTP id 00721157ae682-793c6701158mr564687b3.23.1768500883222; Thu, 15 Jan 2026 10:14:43 -0800 (PST) Received: from localhost ([2a03:2880:25ff:57::]) by smtp.gmail.com with ESMTPSA id 00721157ae682-793c66c726dsm206407b3.8.2026.01.15.10.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jan 2026 10:14:42 -0800 (PST) From: Joshua Hahn To: Andrew Morton Cc: David Hildenbrand , Muchun Song , Oscar Salvador , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/3] mm/hugetlb: Remove unnecessary if condition Date: Thu, 15 Jan 2026 13:14:36 -0500 Message-ID: <20260115181438.223620-3-joshua.hahnjy@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260115181438.223620-1-joshua.hahnjy@gmail.com> References: <20260115181438.223620-1-joshua.hahnjy@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D=3D MAP_CHG_NEEDED && retval =3D=3D 0)) { ... if (map_chg) { ... } } No functional change intended. Signed-off-by: Joshua Hahn Acked-by: David Hildenbrand (Red Hat) 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_st= ruct *vma, =20 rsv_adjust =3D 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); + spin_unlock_irq(&hugetlb_lock); } } =20 --=20 2.47.3 From nobody Sun Feb 8 18:32:06 2026 Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 329A13D1CC0 for ; Thu, 15 Jan 2026 18:14:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768500886; cv=none; b=iueaVRCK7t+1JtLTaC5oNpStCOyZeh3qab9ITT1jArO3a7GXnINxGSql26+twO8ZEByvAgxzX50g5sVPr19wrcvBk70dOdU+av4LZkZvD0hQurpPAdhEc7rkVqSLSCN3KyXgrSBiGB3FkHHxSZlVAmZCPhJ3AHd48p4gm8oDwRg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768500886; c=relaxed/simple; bh=IsdQd5K+/xiJavob8b9TBNDXTavBwN695YHbQ7zdfAQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jhSBrAXcjR6XgWQPgHUWdM2TLIMQZZPunJ2G7IUoaAfl+y6gANBk2jS76tcZrqz9SK520l+izFFt7BF1hUxqEdrgMdVebxfO6AWvZzmTWdiZKQFudv3OFiiGR3BR+GGiGhBNVpcJ7I/yh938hbK7g632qUcKRcB1kjwOJj+V4R4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nmysFnDS; arc=none smtp.client-ip=209.85.128.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nmysFnDS" Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-79276cef7beso11454667b3.2 for ; Thu, 15 Jan 2026 10:14:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768500884; x=1769105684; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Q65R1O5X853GTQScX78GsAxTu5/S4jS/8Wdy7LtJyC0=; b=nmysFnDSIM1LPuQsfK0e7jF96S85yEVwyiVwh2bIPQdl5YLbhg4ynuuaigJNWDlGsP eOx3/yz2571eQILfsUvTBXIq0qSUPg5ut+aCvS70GsKbB1NeyG9Nm4JIgQ07rZtDHM6z 0ckSsXxUkNaBseA+mugIekPopEaNahSAVxeI5IjnzCZhTmav1SR7lIS3lrxq+n0Lshaj vS40D/QUxTOC2QuK7ajO9HA0TH4IKhVYDwjDfaK2+D6gWaEW47DuN7PTNIKv8eu9xRGF iYvvGFWHuR1AgBGahgG4CtwLd6BxxHaMkAWxVxpqy99YRMSwk0RZLKFz2tlJxxZhS1Ib Ts2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768500884; x=1769105684; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Q65R1O5X853GTQScX78GsAxTu5/S4jS/8Wdy7LtJyC0=; b=ppZLUNVUO7jACa3s6fv12JAOws+P+ul+m318NypPPS6l2PV2jmUj4QHTof/SHgmWsD MJvPx6SW2wcS5q5E1rdYJSYuZW7S4ZF+wSKpd34yNTKLvN3WnrEdNx87R/NY+2raHpM0 GzDk4hDm7RDc0fscYwa5y/r59gn8f25oAN+idHoS0vyAWpH5Cc09G/52EqwC4nbSjHlJ RCTSVtFUkuti7qvwWWsNoKHf50VgwTR9LJTPPzMEeeAHwF9KpjWZ/v7MfJDC+reKGSbw E47A7JP4qmJC6ufEdX7hSScDLdCpgKswQyKYkptIp+3+EpCZ/70rra67+ox7iYzouQkI LfdQ== X-Forwarded-Encrypted: i=1; AJvYcCVzfKy8PTY+o3L6XCy5wY8H0DWuDAs1nFB8lEVtZzJcmJb07JQXm1rZs04VlSnOMrXq3zQcNFJbITE99ys=@vger.kernel.org X-Gm-Message-State: AOJu0YyTEGkGgQN4R2v9dioKQZ4CmHyyN1KYFwi/D7OUMQKGNgqVDIYS WpFwieRviQI9Rnruozb7g9zCKMNeGvFw3N0f+dmxWOAzvAaOfVyvCdU/ X-Gm-Gg: AY/fxX5VXWBHWEjjmvL79m89akZ9wQ7AaOYd+5Hfth1bMljhS1RI5pK9gFxpUMNWa/o in5FgWz0wO/CaaeKShxsWBrSAEXlH2iud2JAGdGJH3L6SCt0scPAL0xVznMuYMoAQGcPtxD8CRZ rgtNJtJYyLL2HvCH9jl7Wd4BsRI9vI+Bg+71+/MPm1XL//24+WYlKUlxOCP9tiaUXtM4MPzvEXi SNKC9IGqdioK3UXkHGCZuGe4zg1USMUBcvnXKaq5zKlm7rsaFAS221QlMOy7VOAzQuWOwHgakJS xHMNotsPRsxL78/HJFQON0Y0k6J0aT8PuGQbahqGUdO7YA9IPCRCX6l+nUpVlnRAV0iznxjTMhH sABWnj6zgG+nACwg+XMCj7FL84BoIfJdSbcNoqig1iOswrQvyVRlaljPlmwABl7zE8HgISwplb3 PMlaoF8xFq5hgqTc4Ytng= X-Received: by 2002:a05:690c:fc5:b0:787:f341:6b06 with SMTP id 00721157ae682-793c52b19a6mr5628617b3.24.1768500884230; Thu, 15 Jan 2026 10:14:44 -0800 (PST) Received: from localhost ([2a03:2880:25ff:2::]) by smtp.gmail.com with ESMTPSA id 00721157ae682-793c671a9d7sm174197b3.25.2026.01.15.10.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jan 2026 10:14:43 -0800 (PST) From: Joshua Hahn To: Andrew Morton Cc: David Hildenbrand , Muchun Song , Oscar Salvador , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 3/3] mm/hugetlb: Enforce brace style Date: Thu, 15 Jan 2026 13:14:37 -0500 Message-ID: <20260115181438.223620-4-joshua.hahnjy@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260115181438.223620-1-joshua.hahnjy@gmail.com> References: <20260115181438.223620-1-joshua.hahnjy@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Documentation/process/coding-style.rst explicitly notes that if only one branch of a conditional statement is a single statement, braces should be used in both branches. Enforce this in mm/hugetlb.c. No functional change intended. Signed-off-by: Joshua Hahn Acked-by: David Hildenbrand (Red Hat) Reviewed-by: SeongJae PArk --- mm/hugetlb.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 432a5054ca1d..75f002f18365 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -578,8 +578,9 @@ hugetlb_resv_map_add(struct resv_map *map, struct list_= head *rg, long from, record_hugetlb_cgroup_uncharge_info(cg, h, map, nrg); list_add(&nrg->link, rg); coalesce_file_region(map, nrg); - } else + } else { *regions_needed +=3D 1; + } =20 return to - from; } @@ -1247,8 +1248,9 @@ void hugetlb_dup_vma_private(struct vm_area_struct *v= ma) =20 if (vma_lock && vma_lock->vma !=3D vma) vma->vm_private_data =3D NULL; - } else + } else { vma->vm_private_data =3D NULL; + } } =20 /* @@ -2076,8 +2078,9 @@ int dissolve_free_hugetlb_folio(struct folio *folio) h->max_huge_pages++; goto out; } - } else + } else { rc =3D 0; + } =20 update_and_free_hugetlb_folio(h, folio, false); return rc; @@ -2672,11 +2675,13 @@ void restore_reserve_on_error(struct hstate *h, str= uct vm_area_struct *vma, * be consumed on a subsequent allocation. */ folio_set_hugetlb_restore_reserve(folio); - } else + } else { /* * No reservation present, do nothing */ vma_end_reservation(h, vma, address); + + } } } =20 @@ -4703,10 +4708,12 @@ static void hugetlb_vm_op_open(struct vm_area_struc= t *vma) if (vma_lock->vma !=3D vma) { vma->vm_private_data =3D NULL; hugetlb_vma_lock_alloc(vma); - } else + } else { pr_warn("HugeTLB: vma_lock already exists in %s.\n", __func__); - } else + } + } else { hugetlb_vma_lock_alloc(vma); + } } } =20 --=20 2.47.3