From patchwork Mon Jul 29 11:25:23 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: 13744734 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 97199C3DA61 for ; Mon, 29 Jul 2024 11:20:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C75A56B00A5; Mon, 29 Jul 2024 07:20:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C26096B00A6; Mon, 29 Jul 2024 07:20:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A9D096B00A7; Mon, 29 Jul 2024 07:20:56 -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 8AEEF6B00A5 for ; Mon, 29 Jul 2024 07:20:56 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 453751C100C for ; Mon, 29 Jul 2024 11:20:56 +0000 (UTC) X-FDA: 82392548112.14.D354A28 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id B053E120020 for ; Mon, 29 Jul 2024 11:20:54 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Y1xfuqoT; spf=pass (imf29.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722252001; 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=kJQiG/5I+17lbFKCGyYuI+CpVs0RVUWdddaEyCf/eUQ=; b=KNfYcDRuP4f3+xTk9DfeXUTydOof07Td67Ke9SYkWv3gUF09YWsYvtiKNkEcF0GKcsHFpn z8QDpv3rqITzndu15lwqeSTJD58qS2p8Zgu9/dSkpcMQOhVZRBMqKLzpGaj51TboC3AUwf AHvjAWenjhrbywWekMFkgVpjKHQUqMA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722252001; a=rsa-sha256; cv=none; b=7cCB7UqlJfi3T8T4viunpUhfqZWn8/TXsO20twAKnYrKjyrZCbJsvsleKQU/GmR46cWRdb EySwT2QJY8x0j/izpIZbof+tmwUxxr+1MtI1ro0m2bmD6bhYVzyCflhkaFYBiuwVsvLt3S IWZhI4ORq+fmxqdVL25IyqqeBz/TnBA= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Y1xfuqoT; spf=pass (imf29.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id ED758613EF; Mon, 29 Jul 2024 11:20:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD9A5C4AF0A; Mon, 29 Jul 2024 11:20:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722252053; bh=d7GxkLwHXdQyb6XsJEXUauGOBeH6/SyL3Iuz9vNzPwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y1xfuqoTF8RBa6k5ApOc1e9IzEm4y5wIehqq1Lak4a/tussklfMkbwl3E865wK7Sg NAqDweP7jioqqU8PNGlclmJy+bVTfwgSxrpH6Bn7Cs8W3/dLWLQpvp+BcZMpqoO2qN 9d8znmyUTNzACuqjIZz0RwW+widCJiDk03ZWFhnpT0Q3dPKfYpQAwwAS3wU3LIj0Yw 7YVZuuB/lWRsQeG2lg59DOcbTCrKpJI5IUFSFF4RsrlXmif7ZmLyWSf4nerSPMXzZm o594WC/rvrMnYCSgW/pSL0QNyaXpuXUSFzjnSM+XwWbty1FHL/hvjGQSyRY2kdY73J IySG9ESyAF6tg== 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 v4 11/22] mm/zsmalloc: rename reset_page to reset_zpdesc and use zpdesc in it Date: Mon, 29 Jul 2024 19:25:23 +0800 Message-ID: <20240729112534.3416707-12-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240729112534.3416707-1-alexs@kernel.org> References: <20240729112534.3416707-1-alexs@kernel.org> MIME-Version: 1.0 X-Stat-Signature: ekse1smczachhyns6fuchxm1qpkmhdf3 X-Rspamd-Queue-Id: B053E120020 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1722252054-819993 X-HE-Meta: U2FsdGVkX1/jG/qJT7JyDcKg5uvA6rOFo5iwtjwefP9QdtpAXtKPEbRw3foU1dx1WaGNy3gzXdau+FpWJhg0ECjS504SYDxdtlGt9WZGABtJ81sF6rFxfpzOPrlrU1j0nU44LW6k5UcLEHnu+D7C6hi9sb5oNQy0tkIBw29rdClWvoFHPlYGY9fualXTD3qRI3+ZENHwfTtoQE7G4rpi9QtGJ8wRZlQNh6oMHRvnujphMQOr/Y6diVFlcx8hwyYAf+wPNqYC3M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em77tq92UTCMA 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 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 --- 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;