From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.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 7FC823FFAD3 for ; Tue, 9 Jun 2026 11:36:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781004969; cv=none; b=ALJCD0c3ZN6D+8k9NSuOggdPooQ5/1Pym8ZP1JL6gpiNr4jrfhQU/p6F/pkCfPC10Va+3e12d6vojcmTocyMeqQiWp0i08iV86oIoTSmCUcLQp3fkhP6tph5HKcB4K4ARv4oQptwwohqcwAKGCroL359AsY2xckbEiMD627W5eQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781004969; c=relaxed/simple; bh=OWl8XodKuHvtGBZB4JPH6bzMG/fxw0APweCIxIBRAv4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QUzarSd7qtXKXAvdq3uiMIPTq1HYuWsRJ9J9r+kEwSj7gSzZfUecA2QrjUS7M1VgJQDtd99YX2kKiWaoLtohlaRw6DN0oKW2/oz53amugN4jyThZKsU8VJUjq5UFyUvBpB2BYlwtqaHIOjuBc2wibGFMgt4UePjC5nN8Daa/2IU= 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=J5MlSYlS; arc=none smtp.client-ip=209.85.216.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="J5MlSYlS" Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-36b9033d230so2806522a91.1 for ; Tue, 09 Jun 2026 04:36:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781004968; x=1781609768; 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=78gCuAHbgodEfjkwRKqmw0oYajjv5lRliBK5sAWYFv4=; b=J5MlSYlSnAWCAsJqusmgtcKqLnt5dynwQz/vrdZmLjuifGiikTg/5n2Brs7CF5j9TI jmD4SRFM8nH82IzC4N5/6khphsxknz3tcdGN12NTiN/oL43nDowo4fCpFbhtTlBz3b9Q T/hQ/UPdrj+mhK6/oOLSqw0pEsILHZjAjq3/CuO/69w5ub4nv+ARGWhr8WhUrRixSib6 z/j0wKCluB5vPf1YJUFIHGCnyGIu2kO20a01iDZDPe2gQzzYzK7PGY2l/h6G9Yglt155 hw5Rye06CbzadvTvFmky68V7vwKID9jCRgJgNOrouDknGc/Q2LBXf77hxHNFWCZ92iat 8sYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781004968; x=1781609768; 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=78gCuAHbgodEfjkwRKqmw0oYajjv5lRliBK5sAWYFv4=; b=Xckltc8f1rlaHvHiVmfJmh9tIxSqmTiuW/NmZTc/59tL+XppgQmR3DW+FPZ+lWm5dK wW6O0EgCQlgKbqDFqL7KqLQceAa5E5acRmKJ9RgOXDowDaKC2NEPYRUACUHUVLBt2cr6 gMJ3jCViwpqiOSAKRIdy9QjhbBcnUb1NcUv1UpvbV9Yz15PYAvMJGagVhmAc5ykaoDe1 1eqj2MFrDy/5tdey6K7oIO1eQtFI1baL2XmfZyvqTZVkS4haz5m+gR8UXUSRfnVR+dum TOrpaNNGTr+uD7Fdk0pvSfMsEtgcnOB0S31bXsg7oUrQ8et+t7bORFpT5voq3juUV6DK BPbQ== X-Forwarded-Encrypted: i=1; AFNElJ9ptKwx3k6QZqQqIWAObgyT/6eKDN4eHbo9wsPBCb3qM9pPIOzGSjUqzmdvWXECVpF6sqPYVUYORa0G++g=@vger.kernel.org X-Gm-Message-State: AOJu0Yxv06vzhIIVWsPR/SDIiFGFrS/n/AJ4H0F9p9PeElZZpkU8Q4iO HzLwgCv3TdBi3dAZRlOPZ45v1zJc80vQyYYtc2kUgNA8r/nk+0zq9XaE X-Gm-Gg: Acq92OE30PGRA/qDIyTyooXWNQ+m6Euxjr91oo3BLnqvRF/aA5IQa4novEIXGGd6Gsn IuCm141GxIx3OTg5ezIwpf9KTYT4vscu4y6asK073wGUjwNQQBLTqCCO0bUJjlyA6WItRWdYoRL IfqAsA+Q5X8E/u/5jAisTrCkhAhGG1Alc4ltPOMdt95oo3AxXnAPyDpbsQAmGJjWLnpOQt4+HgE si/RWTOAGdir0JPlXWS3/IUyASlN+7513Cd99y5unEJi7b/dQHEkN0H40lVoehY9bfDZwS+XVYp dCJ9qEuMjYAmIsb7If8b1r+vNHuzcY/T1vL36kTWEQYXwQ0nnoj9h6kFjqIwoWoBJAcWCRzLcAn hWYMOqqvBjG78AvEuHqmn3/HwMlZVe6uhvJOGm+rW6zto5GEC24/Vun1b9+mUhUbEZJ7KnmxPgh cgULoF3Hohd13c8daOGGoFuuiDN6yV8eOL87c5dadj6X/nCl9ZRQ== X-Received: by 2002:a17:90b:544e:b0:35f:c493:cac5 with SMTP id 98e67ed59e1d1-3713337027emr15348877a91.16.1781004967777; Tue, 09 Jun 2026 04:36:07 -0700 (PDT) Received: from ubuntu22.mioffice.cn ([43.224.245.232]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36f6c668e98sm19655292a91.5.2026.06.09.04.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 04:36:07 -0700 (PDT) From: Wenchao Hao To: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Minchan Kim , Sergey Senozhatsky Cc: Nhat Pham , Joshua Hahn , Barry Song , Wenchao Hao Subject: [PATCH v4 4/4] mm/zsmalloc: document free_zspage helper variants Date: Tue, 9 Jun 2026 19:35:20 +0800 Message-Id: <20260609113520.3507783-5-haowenchao22@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260609113520.3507783-1-haowenchao22@gmail.com> References: <20260609113520.3507783-1-haowenchao22@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: 8bit From: Wenchao Hao After splitting __free_zspage() into a lockless core and a wrapper that does the class-stat bookkeeping, three similarly-named helpers coexist: free_zspage / __free_zspage / __free_zspage_lockless. Add a comment block above them describing what each does and where it is used, so the names are not easy to confuse. No functional change. Suggested-by: Nhat Pham Reviewed-by: Nhat Pham Signed-off-by: Wenchao Hao --- mm/zsmalloc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 1602ccb6d814..c0edce381d20 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -878,6 +878,22 @@ static int trylock_zspage(struct zspage *zspage) return 0; } +/* + * Three free helpers, kept apart here: + * + * __free_zspage_lockless(): bare core; walks zpdescs and returns pages + * to the buddy allocator. Caller owns all zpdesc locks and has + * removed the zspage from its class list. Used by zs_free() outside + * class->lock so the buddy-side work does not stall the class. + * + * __free_zspage(): __free_zspage_lockless() + per-class accounting, + * under class->lock. Used by async_free_zspage(), the worker for + * zspages whose trylock_zspage() failed. + * + * free_zspage(): full wrapper - trylock zpdescs, remove from class + * list, call __free_zspage(); kicks deferred free on contention. + * Used by compaction. + */ static inline void __free_zspage_lockless(struct zs_pool *pool, struct zspage *zspage) { struct zpdesc *zpdesc, *next; -- 2.34.1