From patchwork Thu Dec 5 17:49:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13895893 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 66023E77179 for ; Thu, 5 Dec 2024 17:50:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9956A6B0177; Thu, 5 Dec 2024 12:50:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 816CE6B0186; 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 52D4C6B0177; Thu, 5 Dec 2024 12:50:08 -0500 (EST) 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 ACF0C6B0177 for ; Thu, 5 Dec 2024 12:50:07 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6363F1C8696 for ; Thu, 5 Dec 2024 17:50:07 +0000 (UTC) X-FDA: 82861643508.21.B6ADA7A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf03.hostedemail.com (Postfix) with ESMTP id 998C720015 for ; Thu, 5 Dec 2024 17:49:58 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=IBxU5un+; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733420995; 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=OZrTVTlx3nBqz9b5XE0au5WzgdiWje429f4/0vfxIOQ=; b=dV5/X/kPT2tnRjFXxsnte0M9bv6+NZpAy68rWtxv/Rwn/bEJ6LCZfFCA+YVJH8RY1CuRNB /S2yWUP9sSWNUceJsS/LQZDCHlSRbLV5o4p8vNhHybjHr2TMEs98qpreKiCHgl/0DUOdb2 1rmWwqqW4CxbqFitsa5CnafXgQdZS5U= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733420995; a=rsa-sha256; cv=none; b=M6ku2eob0oppP6LWMrYtkmuGU1jNHkcw/SvYdKZen59UQAm/wQeweBjqTssw82pg8/Pptr vC8l960+9a3xi/LOsnde0mWJZUqTwAdYxaimlRURD6JIs4rWz+nFYEvTf8AXffhfQT5Y9e o04XhTEOniVRcZNLwmSvVM0+t2kvaQ4= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=IBxU5un+; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=OZrTVTlx3nBqz9b5XE0au5WzgdiWje429f4/0vfxIOQ=; b=IBxU5un+UAvIX7arDihWj5LZ5R m4RqM4n2T0Sb+WZx7akVK1koE5KVkg447TDvTSihHKpPWazEFnCzG8/vU7UQXztHcvljO3/R4eJRu Fzt/oUENOPWDrGuWT6BXmCvpdwOkiE/iuBoQUXXxOKmLOUhQuApSNSG7z5WsKO/zCIFw9f8Nukma9 nZztN8KUVtbIcz1ILsjGRBBprqMNLmc2119sStJGHyBTU6Xdx4HIv43L5YWE4HoK2BvWw0QNcHjeA pbQRTJioY2DEDmnOak2iPnMWYz+rhX3yfDTNr48QBfUPfuPKjHFyvUXfld+vduiyFIAIAv/+Zc0Wj BWkAzVUw==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tJFzI-0000000DN9R-2VVI; Thu, 05 Dec 2024 17:50:04 +0000 From: "Matthew Wilcox (Oracle)" To: Minchan Kim , Sergey Senozhatsky Cc: Alex Shi , linux-mm@kvack.org Subject: [PATCH v8 20/21] mm/zsmalloc: introduce zpdesc_clear_first() helper Date: Thu, 5 Dec 2024 17:49:57 +0000 Message-ID: <20241205175000.3187069-21-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-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 998C720015 X-Stat-Signature: doakf91jgize1r53tfykz8tanm1zqbu8 X-Rspam-User: X-HE-Tag: 1733420998-237549 X-HE-Meta: U2FsdGVkX18HUaFlQUIANSEvt3NFUsRAHCg/fgUDpMx+4rHsvfm5gBW5VREaLs9IGc6H7HRSH7Oxy2r0vu1BCvw+Pr93QUDvBVbYJftMPsuwpQ8ZMSrst94E9+7z/grt2jaxVDruDBMDQolcph37J8a5LqxM/tZq0repn/3a2C53KeTaPpTXevXXi0e0i8Boou3DdRdzy0ZgzyPKP+vTyq99pIkq8I7XD/ahIIvwaH5u2Vm9WKowSZeoxzEbqn15EZEF9HIOsCehpR9NffZBmT4MUGI0itxixniaIdUfntGf4SvZotblkRRHB9m4r6Xu8/tEtVM7pGqXmveqEbZSnjxumx+UZonZwTFIlaYOTM7RUqX70bh2uIZ3eV/vaYDbvb3eGMfbpKjQ9hJHZqQLRJr7duuD1fVFkRexFwYN6YIwlWVElxqWCkJpPKqCCy40rfmxKa7MVAOD7ZHXmnqMZCrEUjkJJAxwp7UfimwOkUWKSfCkpLcvnZlPcU/jEXTiz9S5ztMGs14GNlkZHnjXmwjN5EKAJD93iLu7jx6JRiD8uHjuwbvE6sKhRogYdkjy4TKoDCXgLUzlsGjO9ldXdudiTV3W7C/T6D99ldN7MVKA6UfTAUNuBCBeRXpv8GxKUUV+hSHzP2NbahBK4ZOJPlL3rXlxmktxQSLIBBeSLLpfZ6FtriduimItgDJ4ykv+yUQzRFGTdDXW8DHdi9rMHolH+VrPhU9STf8ERz6Gm8Ah8yTRDZkgtxXUgMkQRKklOWh7orT8jt+HUDAR7Rg/SK3QkFMQgWvZG8g+DE+6B4m0q7PHq1fPbHNPc91pXy+SsvJMm93kzP0Z943emExNUqywPF7Bfa6pfu+5YTEdUJgXwUFJb35rNFOCZigg5hbW8ZeTABBGkcxSeOoQqtMrOdBeJuZ95COkgmk60zdUTuN6yKUJKsZcd/s8suKE2LXBbaYJfKbnazNLujAEc1V glUwhQ+C /cA0pDeIU1fQRf+B6aXzTm0aiK0D5o7fkfsoChXEEgbF+JvcEH85uRT7i8hLb/1hL+i+77dDFagb1t+XC+4jbMsHtfWm2kE9FbVs+kU8iJm0wAfS0wIINGUBdX2GiTAOHOzfg5Fp1G4Nck54N55t/2q75ksA+e36ycZKGFx4n2TT5wSF5Yd5moOOkKWqiamzSI8b8RxdMo4a1T+B91MuPwJGbWRrlPJSaXJdZIrKlsYcPfeFhoe5g8H0qDDTru9R9zSfd 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 Like the zpdesc_set_first(), introduce zpdesc_clear_first() helper for ClearPagePrivate(), then clean up a 'struct page' usage in reset_zpdesc(). Signed-off-by: Alex Shi --- mm/zsmalloc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index f9a9c2400e41..c0e7c055847a 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -251,6 +251,11 @@ static inline void zpdesc_set_first(struct zpdesc *zpdesc) SetPagePrivate(zpdesc_page(zpdesc)); } +static inline void zpdesc_clear_first(struct zpdesc *zpdesc) +{ + ClearPagePrivate(zpdesc_page(zpdesc)); +} + static inline void zpdesc_inc_zone_page_state(struct zpdesc *zpdesc) { inc_zone_page_state(zpdesc_page(zpdesc), NR_ZSPAGES); @@ -840,10 +845,8 @@ static inline bool obj_allocated(struct zpdesc *zpdesc, void *obj, static void reset_zpdesc(struct zpdesc *zpdesc) { - struct page *page = zpdesc_page(zpdesc); - __zpdesc_clear_movable(zpdesc); - ClearPagePrivate(page); + zpdesc_clear_first(zpdesc); zpdesc->zspage = NULL; zpdesc->next = NULL; __zpdesc_clear_zsmalloc(zpdesc);