From patchwork Fri Jun 28 03:11:26 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: 13715397 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 30977C30653 for ; Fri, 28 Jun 2024 03:07:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B72206B00AD; Thu, 27 Jun 2024 23:07:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B20E06B00AE; Thu, 27 Jun 2024 23:07:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99A2E6B00AF; Thu, 27 Jun 2024 23:07:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 77E876B00AD for ; Thu, 27 Jun 2024 23:07:35 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 369321A14B3 for ; Fri, 28 Jun 2024 03:07:35 +0000 (UTC) X-FDA: 82278812070.03.E88354D Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf09.hostedemail.com (Postfix) with ESMTP id 37485140006 for ; Fri, 28 Jun 2024 03:07:32 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=G93JlV8Y; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719544040; a=rsa-sha256; cv=none; b=vSrZyc9Icx2UaJqDZ9YjOu7BVC0tXOts88Bum9aS50GJLcRdwIIplQiSHubeZNlerBBFf0 hXS8ptb/+2Iyq7HMwFb08BuxDu2Miv0WsyTgxyF5zrnBcg+o8+2x0YCRRQ5hsqp15xR2c4 TZfFlUrKO1QvAcQhPeQkFii2+UM5wpE= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=G93JlV8Y; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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=1719544040; 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=ByZbEuL2MDpf+Zxk5cYlFhi4HqAeoW8UCkKwELZKWzo=; b=0Hmzt13sbylDDauASU0w1aquwss4s1I7amaCzXC39jb5qV1B3I9h20uBfonyyMa8eu8WQH Qxoy0BJ3kH4vBh/8FmfrOPybFg8ZSLC6nQZy9DvC6x3pENF8KpRlVfvySOghHu8sPDFkqB JweWc9IR+ov4dxUzlCtIJsRbLsSdH6I= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 774BECE2D9A; Fri, 28 Jun 2024 03:07:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF836C116B1; Fri, 28 Jun 2024 03:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719544049; bh=WVCo5FocoDi8mJGyEARAUtW59QMXLmGoSt30iD6IwAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G93JlV8YYzxWgG9GYE5JjU2ygzVYPZRfSW0u+Lv+XKD+uGl5mDGQzi1sW2Ses9l1a jAqs4GDKakVW2T7olETXuSfQGUxe3N79I+c8/cGoDeT2dP/Qw0Y2SuS5rGQLiufXU5 cOLPgU28kk/KZq11ozpMKKNWpsjd4HHmGqk0MlEem4feI7RiQOLPstDBogmGArrQPa LcgEy1h/AuWnFZj+aEkAbS3r6jb/tOYSB09HoP/8yXn74PQtbDa7t5ldfdFxCMsP7Q a2HDHZ12nEeMpUneZSsUIak2KUFzhCLVi5SF4Or2usMTBhpCCoUqLLHZLhaZQkpljK xnmC1xGKfZrYA== 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 Cc: Alex Shi Subject: [PATCH 11/20] mm/zsmalloc: rename reset_page to reset_zpdesc and use zpdesc in it Date: Fri, 28 Jun 2024 11:11:26 +0800 Message-ID: <20240628031138.429622-12-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240628031138.429622-1-alexs@kernel.org> References: <20240628031138.429622-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 37485140006 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 4zcw6xdjp1h1jq43z6ewoajkbwjz3ior X-HE-Tag: 1719544052-611839 X-HE-Meta: U2FsdGVkX1+bv1eyF6eiw9QMJjyPt5o8phY8+MuWaRn3QjGshIxpsYwhHVMMSww9NNjGWmZtu45Ap/TsGmvXfUeldOSsqgehNEPxZOSq1F6YBCfISHJG5Ek0wgiwUHA7xwBqpLwmsra22re+8wvl/Bt4W+VuOG0LD7q11tUmdrROCwjm5gOZP5VxVVKuJbe8TL7xw09i6cehn12q8OchshWhgnIWlBQ3l1ow3gTsUyzjZgnRV3lS2w33zkWkW3XMOR8lWVkpkErgkmejezpgMH7Q9xx3w32rcaA4WEvikF+p0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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 251a6e63e58a..216f8e6950ef 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -867,12 +867,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); } @@ -912,7 +914,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); @@ -1904,7 +1906,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;