From patchwork Thu Dec 5 17:49:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13895894 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 AF2CDE7716E for ; Thu, 5 Dec 2024 17:50:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8B0E6B017D; Thu, 5 Dec 2024 12:50:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C08956B017C; Thu, 5 Dec 2024 12:50:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C3B76B0184; Thu, 5 Dec 2024 12:50:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id EBEDD6B017B for ; Thu, 5 Dec 2024 12:50:07 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 85FD4C166E for ; Thu, 5 Dec 2024 17:50:06 +0000 (UTC) X-FDA: 82861643382.25.2FA7FCC Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf16.hostedemail.com (Postfix) with ESMTP id 8DB1B180005 for ; Thu, 5 Dec 2024 17:49:48 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=cHXKYiCa; dmarc=none; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733420997; 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=4xHbmQCRdJwLFxwWLnDqxLyGzIaNRK/5CMiN435paJY=; b=7Q/KxaN4o8xmmTSP9IW18b82KGrM/zfKyvO5wfGvFwKr34tct4eRgpnvdiu0DdzknnaySB iWMWj1DYM28uBwmSckZVLSsSklA3AuJx704pxkkmqPNeuUptZpD11+kpS4f6c8+FKzR7j9 mtEB6KjSBulhM7x0MMq/w/ZRubwK790= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733420997; a=rsa-sha256; cv=none; b=7mUo0KMk+muwwPautDjjxt278RiE4+id7b9Qu96EPnwix3KBeVclw+ROiS6H/eNpsIOlD9 eYoVzkRFKr8s3QO6GFX8sucdpcOLfC2P8ALkKv2BMHu+f6THoOFQuaPvwWp//yHUVjF7JR ygQbVsSxd4B8S1EQ9Ivh3EdxyimjPVo= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=cHXKYiCa; dmarc=none; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=4xHbmQCRdJwLFxwWLnDqxLyGzIaNRK/5CMiN435paJY=; b=cHXKYiCa1o7H9pqjRBd1A5G3aD umYbo2kLMcPB+kF48Gi/kUl/07Ha5LiSvwwCyGziYORRgfRSa5K7OjmDQYy/pngQOo/WKA6fq6bD/ B6OX2Q6fZqXGj5RripaSHJag8y/AMo7hpHAeg7y1XUG+bBZmmlu4bTHX+ttoNN/XIepM9pZOmgpyW n+uOxBIptB85V8kAvq7XyI88YGMaByPuXayauzh+GSz5GkXIpxh5d7z6vD6wC28CgMubM7Wda/k2Y 1wtd4ytNgDrsti24CPaKEZ2scjl2uvRuwNar1CQBldIxsjyA/Q0kZCkxz4e8ZJlp5fUEFRi6YpwBR 043MPE3A==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tJFzH-0000000DN8Q-2Cws; Thu, 05 Dec 2024 17:50:03 +0000 From: "Matthew Wilcox (Oracle)" To: Minchan Kim , Sergey Senozhatsky Cc: Alex Shi , linux-mm@kvack.org Subject: [PATCH v8 11/21] mm/zsmalloc: rename reset_page to reset_zpdesc and use zpdesc in it Date: Thu, 5 Dec 2024 17:49:48 +0000 Message-ID: <20241205175000.3187069-12-willy@infradead.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241205175000.3187069-1-willy@infradead.org> References: <20241205175000.3187069-1-willy@infradead.org> MIME-Version: 1.0 X-Stat-Signature: b7fjkyt9793mxqt3jbcfb73ndqguqsk6 X-Rspamd-Queue-Id: 8DB1B180005 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1733420988-916231 X-HE-Meta: U2FsdGVkX19p74PwWsvTRwT5gHr6mPr9CsStIhCaDzu0nb5Gox2eukRMvkMZqO6lKhan9oxm1KR7FZthCfBlvEWzL1I5nuSPiQ5C08KyZ05kRXk4fZmSIJzqr1fxutls1UsOznBt+vB5+NHtT0/4jvxulLgBIPhBAaQbaTDiK2Y5lDwx8yeHRUAms+wAyP5+OjGjypckhguS0AI2JDOhrwGzl+iPr1DS3Cc6RVb1I/JOZlLXCV4Q1UbY3AU4iaBiRhHtT/RIJAGwLLOwyQjbGRowheu+nV/poDr0C13DUSvQArZI2vuoccCkc/Qk4b+6u6pD0jL3J60dMV4ZjlBsxsgKYClFtNGdful+qqKkosPwicsRNUQ2vmz5fIf/l8X7Vmr9DJ+qbdEURGrijkYzySMxQnyZD4hjMuIK+RsISPocvexc9Yiu6hIecKtZ39e6RZFn9E9XkLN8TLjrKZJG9JiDIsD/SyOon5dQgfMr3jlx3573kyDyB8UDibq1ezzvgzp0nmpb/fYQdNadytaC2NilOaGDShb7/3VJ31W0qIsp0TRFY4pRD3sfajP8XObLXSKMoJFroJSqjJiltp5kh0A4G3AmimBAVgqfPPIb9EwjmZmDjsLT9lta1/SwKAIS7eE7g3Jcr6m9+gj/YUSfnM0DooIc2ju/wnipsHeyGKIcmMKXlZDftRgGxXlU9sl32euLuFT6FadEzo/NURej+Q1jZbliQjzk7EYtnW3IhHhBhneo/HDfwjP/xSRf4lZWEYzj8Hqgf/qP9gYcWJIs269xMG7uHfva6WewTvm4+oLL8NYeqqnm0GFk1BzY4AM/GEP6tQJhZJg1GfTfp++MiUYdqBfhmkhtjb8UOfkZwbScOUn+z5R47y+fmjNleI980JN6OsaqeA+JZ0yKmKI1VdhELzP7/tLy3qhE1pSdS19ZxBwfxYbi+NmIzCTnUt8KKv0FVlPVufkmBAqmvdP GzGviukV bxRDNGWB9TGtQUzTw2Qx9l5SfHw5V/H7rgl/J6vfcame/oF3XcWi18LczMz1lLAbWtfGhung1qc/pv5R1EZIkxmZ1uqkNUX59/UY0fzv1N7E/GiwulQYY1LfE8Bj2n1kfrteoDlEfh8TEC0i8BRA3wsT7clyF5DJYhQC+SkV+PGZ8h20ZiAYVUOwH4xwdurWBpx60MfnGNXEE8tcNg5V39Ic8l9ULqMw7x1WRdkfWUbx3GaUZmqp0771k4bsZU8KCVjvd 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() which 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 Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index d8f2f8e5c877..87b2b100782f 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -861,12 +861,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; __ClearPageZsmalloc(page); } @@ -905,7 +907,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); @@ -1884,7 +1886,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;