From patchwork Mon Dec 16 15:04:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyeonggon Yoo <42.hyeyoo@gmail.com> X-Patchwork-Id: 13909896 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 6B770E7717F for ; Mon, 16 Dec 2024 15:06:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 94E536B00AE; Mon, 16 Dec 2024 10:06:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D9056B00B0; Mon, 16 Dec 2024 10:06:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6FF6B6B00AF; Mon, 16 Dec 2024 10:06:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4D9B36B00AD for ; Mon, 16 Dec 2024 10:06:08 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C01E2AF93D for ; Mon, 16 Dec 2024 15:06:07 +0000 (UTC) X-FDA: 82901146734.22.868F8C9 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by imf19.hostedemail.com (Postfix) with ESMTP id 6B3DB1A0031 for ; Mon, 16 Dec 2024 15:05:34 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WxAd3zvx; spf=pass (imf19.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734361545; 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=SDy/4l6WZCYHIxqVeHu4DE3K2dZLBweVBJks1R6lg/Y=; b=jefMbT5DPyX7equ/j/+o9ju1lekaPkJiB+0ADMEwaINmFJBAKeTiHQluiZI5Ug3Y030fd9 BJB3YV5aLIHy0OiCsLkA73gWkygrx4t+ZAbSEqKyRflooOhHKGUvG1htKXf5Y6xR4bGxNV Gm5SljN6iQRkqbSjSWkZZnVygNeqkjw= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WxAd3zvx; spf=pass (imf19.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734361545; a=rsa-sha256; cv=none; b=N0c5U9cWSymfR0JOP5QiBwVyhMritTAVzAZhc2y7hTo+6bU5pg3wYymA+/W2AEaoeSElXv TAjnnUHrPp4DCpKKAiGQUiy60FkaBysQO95b0TNpP3jua65G+cUzyaTgjNvm+hzV34ht3H v5C4F2FIH+BoJ2djk8N+17kWcisZwuY= Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-725ecc42d43so3603583b3a.3 for ; Mon, 16 Dec 2024 07:06:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734361564; x=1734966364; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SDy/4l6WZCYHIxqVeHu4DE3K2dZLBweVBJks1R6lg/Y=; b=WxAd3zvxmx9SOQbX8vfPuZHaAqyPk/P1VtgyxL4OXQ28+WkkYq4UBng1CLj0V/t4iv dvNz6lN4I6fNzCbASFVi1Q4JiAWfRNNgVIaJq3Ylm0g9wuXRmU4JfDZTUgkgfjDyTCRm osPjZ3KgGHY7rE0O54nbCg69Hbohpk8l2eY895aUvJvVfUqYjdQ1tdDYKNjsvLW7SiOY nwiztazgAZTG6OKM22V7rHbY7Q7YDO25/rKxndtIYohtfJ0m9ARhJSFUpj/xijLTC102 rL0PTJ1DbPQJinklP1x4309hlWAcDdTJv7bnrc4NDipIw53ppjieHhQHXv6EZ3m/9GGK m8SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734361564; x=1734966364; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SDy/4l6WZCYHIxqVeHu4DE3K2dZLBweVBJks1R6lg/Y=; b=INf0EtVD8ESZA7lx75T0V8S5Xs6+go7WCwUuEisSjxkQ/kH3XNoWcjOBHmCmpr/tyB iUI4NQbcnvgDUcei65XMvZfnOVcV3gRj00k3hciAFfZwZ2QqKy/Osadv0rxHWqsQcH2J 8tVx/saZvKXtr8Sy/GHJfwVYf2R2OzyrdX2AIf/vUvxvufZw6IHWJwrGWwFJdJ8ic/Er SaPtnHOPlS8xvSKTeOpRksn7GSssh76GsbJOO1nL7gC9mwn8cXfEaBi0r92Aq6a/zYiu hbHsHVpeagQde2HAxXG/VCs1tQO8NqYHTx7xGFoVWMYKlkaVHf66BE5VcmOHqHsLhgLM c5qA== X-Forwarded-Encrypted: i=1; AJvYcCXePGNLBvTREqPLmjhHa8FHfqCqFrEfAAtm+ZJHffsa4RdvfkKT5R6s3Bu1sUIHh1gZbGkZZCFKfw==@kvack.org X-Gm-Message-State: AOJu0YzCvuEXxiOYAEDwTuKTRdyuZQzt0ABcug5kWB23th9k0wfgM4Df fCMzdGzBxe9V4W1inY1fyU7QLggiCdh7R9PpbrCqsIQUHyjSz5xN X-Gm-Gg: ASbGncsRpfWGKRsGvUFO2K3O/5x+0YEraMkBIJvLRqggGSYeh1yiQjEFk6GlqGhevMz wWM/tEOTFEnP+24Z/Sumwbz5Exw2kmcryzheztf/4hG767yBlS3fyVJbiKdFOaVbaNQI7lBQVxO ii1R6iSwQL5E9dqYFGebPSdpFJiMwPla24IjVtYvT/3z4m1roNtf1/xHHQ/ePIXcvmtWdOY+w7b KOdeYKuKAvCvRXLc83luEqx7qj/9qUv+WNeysF9YzCKFT+L0fXKuMyT39BmUuOLKCU= X-Google-Smtp-Source: AGHT+IEdw/+Pzemx7XxtqLq06AKTuoV9ilZgKIIM2PTneeVOEZXsB3cNcGgHmuKkrU6W4FdJM3qWng== X-Received: by 2002:aa7:888a:0:b0:727:3c37:d5fb with SMTP id d2e1a72fcca58-7290c248b32mr18630427b3a.16.1734361563802; Mon, 16 Dec 2024 07:06:03 -0800 (PST) Received: from localhost.localdomain ([1.245.180.67]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72918ad5ccdsm4845518b3a.74.2024.12.16.07.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 07:06:03 -0800 (PST) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Minchan Kim , Sergey Senozhatsky Cc: Andrew Morton , linux-mm@kvack.org, Matthew Wilcox , Vishal Moola , Alex Shi , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Alex Shi Subject: [PATCH v9 mm-unstable 18/18] mm/zsmalloc: introduce __zpdesc_clear/set_zsmalloc() Date: Tue, 17 Dec 2024 00:04:49 +0900 Message-ID: <20241216150450.1228021-19-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241216150450.1228021-1-42.hyeyoo@gmail.com> References: <20241216150450.1228021-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-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EVwVKbQxN0IKEGH1o0 aaxXpdNk wl6siS5dEIjoENHIZ4dvrQLWuiSf+OAXcGvm5xQ3fKrCcN7zkspa5J2/PFOkVPhZQzviJy4wRJmE+VIS7OZquz7sReBY1FZ8iGansq7qpJhE8bmdWMmrDI5zhUTrZ4/jukhZrTUVXAlfU7fY81FMW3JonGba3s3z2DlcjluCRdCZsML3d4B4Iu7ZsotOhNXk4bUzuTNSy0lbvwOdEibpeTn60S/H8k79pxDaqd+khkA6Urn1YoUVPJf8pooMqfTiPbdrwbudGT5wdADRfkEfPihhDIML1I+VPLJrAmVp98mtbDEBW55EXZpd87E2D9bij1m/tyzn5+++XvkamZ1MR2t50LoMBDJn4JNYSB/BPk8W+k2tWwaHDNQx5TxnPOUvHflhiH+qa9DbNQ81LsDzzf6J1fIsxgY6SVl3NWtUDGMkXWzB8gV2dziQ+JL2gh4HQwI8gP4EE/pIVCE5w4ER6hLkNpKCfXD7PrZMEzIzMpR/fmj/v7AzhZSgAAKJKplYBG8gXIKdk9WRu03vWjeSO6ImS7GNVP+2DwgEw8nT8bd50+1k= X-Bogosity: Unsure, tests=bogofilter, spamicity=0.491619, 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 Add helper __zpdesc_clear_zsmalloc() for __ClearPageZsmalloc(), __zpdesc_set_zsmalloc() for __SetPageZsmalloc(), and use them in callers. [42.hyeyoo: keep reset_zpdesc() to use struct page] Signed-off-by: Alex Shi Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zpdesc.h | 10 ++++++++++ mm/zsmalloc.c | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/mm/zpdesc.h b/mm/zpdesc.h index fa80c50993c6..2da58339ac5b 100644 --- a/mm/zpdesc.h +++ b/mm/zpdesc.h @@ -155,6 +155,16 @@ static inline void __zpdesc_set_movable(struct zpdesc *zpdesc, __SetPageMovable(zpdesc_page(zpdesc), mops); } +static inline void __zpdesc_set_zsmalloc(struct zpdesc *zpdesc) +{ + __SetPageZsmalloc(zpdesc_page(zpdesc)); +} + +static inline void __zpdesc_clear_zsmalloc(struct zpdesc *zpdesc) +{ + __ClearPageZsmalloc(zpdesc_page(zpdesc)); +} + static inline bool zpdesc_is_isolated(struct zpdesc *zpdesc) { return PageIsolated(zpdesc_page(zpdesc)); diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 3a841e16746e..dae32e051779 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1001,13 +1001,13 @@ static struct zspage *alloc_zspage(struct zs_pool *pool, if (!zpdesc) { while (--i >= 0) { zpdesc_dec_zone_page_state(zpdescs[i]); - __ClearPageZsmalloc(zpdesc_page(zpdescs[i])); + __zpdesc_clear_zsmalloc(zpdescs[i]); free_zpdesc(zpdescs[i]); } cache_free_zspage(pool, zspage); return NULL; } - __SetPageZsmalloc(zpdesc_page(zpdesc)); + __zpdesc_set_zsmalloc(zpdesc); zpdesc_inc_zone_page_state(zpdesc); zpdescs[i] = zpdesc; @@ -1786,7 +1786,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, VM_BUG_ON_PAGE(!zpdesc_is_isolated(zpdesc), zpdesc_page(zpdesc)); /* We're committed, tell the world that this is a Zsmalloc page. */ - __SetPageZsmalloc(zpdesc_page(newzpdesc)); + __zpdesc_set_zsmalloc(newzpdesc); /* The page is locked, so this pointer must remain valid */ zspage = get_zspage(zpdesc);