From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (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 8C5D63630AE for ; Sun, 17 May 2026 12:34:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779021296; cv=none; b=ZeBI2s1pmOIKawlmXvaTKo5FuENpx5Y0wcxy2EYtfuri0xCkH4GWUTCt4yhXag7cALqas5rNdSQa0ezVxX7Qt7Yr/lnHaRLX9Lsi1N/DXgsSbx/eTFP6+sP/1CQ70OrxZkHAP0YBSxVVqtrtExCzURaXVdtcrFrHekTsq2Z8Rk0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779021296; c=relaxed/simple; bh=hpcu4Twx3gTUyOEcBev0JAIwm6gyfAkaADjQ/9AVL4Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RffamxtVOnNLS2XzYImgRPk7H0OsbK/ZEOhS2OCNyb5OaMqq+TGcPcOEklN39EoUULU1kDHSG/uGvCxOtz6kUnrqJzlL3xfXZnCpCokDO/h4aLfreCmzeMeieIYKfuvD0jyYmihRFth3sEJ8PwoM0XUi5vtZYwedBkqybJmMqKY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ryDewiyB; arc=none smtp.client-ip=91.218.175.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ryDewiyB" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1779021292; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p+qbvwXhuv0PGjSrMzWrSxISPxVLoCXGXxeXq3G1w9A=; b=ryDewiyBeRCZdoqBTpXckvUxX+z0N/+lwOy9NWt6v7tMWBWSHsPy9Bm2UM1az67KoFVziL 4rY/MCSZMJ9C8mQu6eV8jNxWPy4mod0R2n3ANZir/baaJ4ngIqMHjoraVu/eQXq+kJQ3lL izt7urPHqoZFl4aDR1Mpf2wt2v7gNmQ= From: Thorsten Blum To: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Yury Norov , Rasmus Villemoes , Andy Shevchenko Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Thorsten Blum Subject: [PATCH 3/3] lib/bitmap: use bytes_to_page_end() helper Date: Sun, 17 May 2026 14:34:31 +0200 Message-ID: <20260517123428.1181981-6-thorsten.blum@linux.dev> In-Reply-To: <20260517123428.1181981-4-thorsten.blum@linux.dev> References: <20260517123428.1181981-4-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1090; i=thorsten.blum@linux.dev; h=from:subject; bh=hpcu4Twx3gTUyOEcBev0JAIwm6gyfAkaADjQ/9AVL4Y=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDFmcW28KCe41WLlmfSBX7e1nx7R+H41YwCGkY5v05oFWP /Oj5fMUOkpZGMS4GGTFFFkezPoxw7e0pnKTScROmDmsTCBDGLg4BWAi6zgYGa5djP706t6tHZlp 81dmBZdvfzT11fTbO84evn2oIqwqw8ua4b8nP9NLBcO7kue+zY96tFz3WEP2z4OJeyJWWpbcDz9 ol80OAA== X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT bitmap-str.c includes linux/mm.h for offset_in_page() and kfree(). Instead, include linux/page_helpers.h and linux/slab.h directly, and use bytes_to_page_end() to simplify the code. Signed-off-by: Thorsten Blum --- lib/bitmap-str.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/bitmap-str.c b/lib/bitmap-str.c index be745209507a..bf245a3eae4a 100644 --- a/lib/bitmap-str.c +++ b/lib/bitmap-str.c @@ -7,7 +7,8 @@ #include #include #include -#include +#include +#include #include #include "kstrtox.h" @@ -58,7 +59,7 @@ EXPORT_SYMBOL(bitmap_parse_user); int bitmap_print_to_pagebuf(bool list, char *buf, const unsigned long *maskp, int nmaskbits) { - ptrdiff_t len = PAGE_SIZE - offset_in_page(buf); + ptrdiff_t len = bytes_to_page_end(buf); return list ? scnprintf(buf, len, "%*pbl\n", nmaskbits, maskp) : scnprintf(buf, len, "%*pb\n", nmaskbits, maskp);