From patchwork Mon Jul 8 06:33:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexs@kernel.org X-Patchwork-Id: 13726199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A5C0C3271E for ; Mon, 8 Jul 2024 06:29:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ACC326B00AA; Mon, 8 Jul 2024 02:29:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A796A6B00AB; Mon, 8 Jul 2024 02:29:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 941CB6B00AC; Mon, 8 Jul 2024 02:29:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 73C126B00AA for ; Mon, 8 Jul 2024 02:29:25 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 2AD85C112F for ; Mon, 8 Jul 2024 06:29:25 +0000 (UTC) X-FDA: 82315608690.09.1291DFB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id 8F61840006 for ; Mon, 8 Jul 2024 06:29:23 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HA0Ua3KN; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720420131; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=02jNdsEZ0aezxhuFGmcStssVo+4mij05629XzD8iNVI=; b=CQ31TRLzhvw5S3/d5Y+1INh6OTHZF3Fsd6BPuWtQ2t3lSctgCA4IqQ4+WgBzNfpkgknKlT eQYY1TOZxxvR1MXXx3D1TFGiex16DiQnd0UfPr3b7uDUnaZoABiuuzf6AxfmOEKkGJGzj0 u9CiBcebuYXrqzXKzSbUs0H6xcCYHqU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720420131; a=rsa-sha256; cv=none; b=N4ISfUP3BzsCCHXqCB0c6FkLRN8QimP5yuZXdwmHDjwlLv8UxeWrF0ojxbuiPyvbGQ8sNF oBgbekQAW2FMeEaXzOeVrXucIXaUG5zMilhqmFoPTLFpIVIFL5PBWIbseYDqaspB8Sjqhb X/9DKuR716D6unhTsiGWLiICzVOBriI= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HA0Ua3KN; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id CD17360ADE; Mon, 8 Jul 2024 06:29:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70850C116B1; Mon, 8 Jul 2024 06:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720420162; bh=78ef+c2vUld0iffCBKj3cSVjaJfSet6R8UzdeRHd7pU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HA0Ua3KNiyLRSlvuk8iE+wvrkOCsWZzp0NhLUjf5s2/M8n++cHNi8RMTSGlC5wHEi ga/OjuScMR/XI5u8/qk7ckMACpo/8r2jtib0KRymUrBa73A5JOs5PbPHtMiENWQkNy QOu4Lx0gn6RJy2fFwwquEray1BrfIRfvhthbzt8ZR6j20/xDY9vX2VTSKs0+G2bfTX 7nl5N/ADiWZtJ0N82eBiTBBzWhTrr+C3DTl+vxqFhB5GqjpdZXcYkXFZ4x+4kdLCiZ 8YaAWhVw7ch+c7m+UhwS5zWToaQnWLCaCPvCPKJtR6CF5CUyoNhQpwoJbIQfLstmLI /YL5eKNTw0BKQ== From: alexs@kernel.org To: Vitaly Wool , Miaohe Lin , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, minchan@kernel.org, willy@infradead.org, senozhatsky@chromium.org, david@redhat.com, 42.hyeyoo@gmail.com, Yosry Ahmed , nphamcs@gmail.com Cc: Alex Shi Subject: [PATCH v3 11/20] mm/zsmalloc: rename reset_page to reset_zpdesc and use zpdesc in it Date: Mon, 8 Jul 2024 14:33:32 +0800 Message-ID: <20240708063344.1096626-12-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240708063344.1096626-1-alexs@kernel.org> References: <20240708063344.1096626-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 8F61840006 X-Stat-Signature: 1w764t6b1qywzi3zw68qz8uo65ms3zdx X-Rspam-User: X-HE-Tag: 1720420163-606344 X-HE-Meta: U2FsdGVkX19WQHdJirFpp1mqtOl2f+nQj13PLl/Ne+8xrqSRa3zLBWSvr9eoazDzKGkHRw6SI5l4tdfW6Eg5U3KbBMxORApXA4eoUOu7W0UgC9gql3jk5o3AtmI8ZXfBwJLp+REwkYM17sobZLf9xrha3e1ynUzseu/E6tMFUIOJaxD8kPy+XujOrxUkWPIWafiQipjOCec3jbCuUocLBRGmkIx+SlNNr3lDV/Qj6VKs9jMO68wtNUewRZWnnppKPHcV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tg2tzkNxFytgypNkhmrGuAhQ/d/CDVE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Alex Shi (Tencent) zpdesc.zspage matches with page.private, zpdesc.next matches with page.index. They will be reset in reset_page() wich is called prior to free base pages of a zspage. Use zpdesc to replace page struct and rename it to reset_zpdesc(), few page helper still left since they are used too widely. Signed-off-by: Alex Shi (Tencent) --- mm/zsmalloc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 9bc9b14187ed..6d1971836391 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -865,12 +865,14 @@ static inline bool obj_allocated(struct zpdesc *zpdesc, void *obj, return true; } -static void reset_page(struct page *page) +static void reset_zpdesc(struct zpdesc *zpdesc) { + struct page *page = zpdesc_page(zpdesc); + __ClearPageMovable(page); ClearPagePrivate(page); - set_page_private(page, 0); - page->index = 0; + zpdesc->zspage = NULL; + zpdesc->next = NULL; reset_first_obj_offset(page); __ClearPageZsmalloc(page); } @@ -910,7 +912,7 @@ static void __free_zspage(struct zs_pool *pool, struct size_class *class, do { VM_BUG_ON_PAGE(!PageLocked(page), page); next = get_next_page(page); - reset_page(page); + reset_zpdesc(page_zpdesc(page)); unlock_page(page); dec_zone_page_state(page, NR_ZSPAGES); put_page(page); @@ -1899,7 +1901,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, zpdesc_inc_zone_page_state(newzpdesc); } - reset_page(page); + reset_zpdesc(zpdesc); zpdesc_put(zpdesc); return MIGRATEPAGE_SUCCESS;