From patchwork Mon Dec 16 15:04:42 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: 13909889 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 A3B1FE77180 for ; Mon, 16 Dec 2024 15:05:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 68BB46B00A4; Mon, 16 Dec 2024 10:05:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 613B16B00A5; Mon, 16 Dec 2024 10:05:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43F896B00A6; Mon, 16 Dec 2024 10:05:46 -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 1E39A6B00A4 for ; Mon, 16 Dec 2024 10:05:46 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A82C5121126 for ; Mon, 16 Dec 2024 15:05:45 +0000 (UTC) X-FDA: 82901146314.02.6D7C8ED Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by imf24.hostedemail.com (Postfix) with ESMTP id E3C7F180019 for ; Mon, 16 Dec 2024 15:05:39 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=iZTE6nH5; spf=pass (imf24.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.178 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=1734361529; 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=ysdxU2iIQ2CuTsrwwSchICK8qjFCgYtZOf41Fa6yvn8=; b=lBR68V7ecvi/fl1meeVTXRDeCf1GbLDsW9gN9PDzCCRHB3mbdBmC6NljT1zKycstvqRRwX VKsO16aeZAjXnMXpd9flTXz0OtCBtmWzNuY4K9wuUxiYmKa2Q3Nxw33BUGu5eDju8Jd+eW zGJqSbJ1xdT8gBucPYDLhu5ElOelS3E= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734361529; a=rsa-sha256; cv=none; b=8L1nJJ8x3BIkc2iaWkVtNliWt1y3yAoIaCLz8KUwFf5opciTcRDFWS/9ExdvVOrPB8eL+0 N07jRjoKe/h/7DS3wDxTasBquFz7RjZPoL7QxiSHLMWunCvj2Duii6O8mJxaebZQcCBTdN cQrS0eewcPFIdyHEgrvnnSZPG9DuBIM= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=iZTE6nH5; spf=pass (imf24.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-725f4025e25so3500187b3a.1 for ; Mon, 16 Dec 2024 07:05:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734361542; x=1734966342; 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=ysdxU2iIQ2CuTsrwwSchICK8qjFCgYtZOf41Fa6yvn8=; b=iZTE6nH5YKjQt9I0KY0ujKAfPB5f+8kBHlMI6GCh3uIfOwXWcnpK3OhVlt8k9OrV3r s8tXNaV2t+KpKJ506+PUSOiB4tKLeztoPi67DZwz245kEo9lw560cb4vsGtlkIODzOs3 SOt3ElAj04Q/Tz+Of+BFSxm+Q5w+v4NWmEI1jD6dAHPGsS9Mx3wfRWs9IvhKQiiSSM7y 79eQ6TT55UwH0OCZg9NJl7DfojWYwzuwf5k2ADjjPZGM6TtHuOCLxdnu5/WCrjXOQzwg uedRZYMpiPruTlFeIzq8NuRpwW1+QUUAtVWmUa+Ou/inCvggX68pSJsfbzsRBEx7e8XB x91w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734361542; x=1734966342; 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=ysdxU2iIQ2CuTsrwwSchICK8qjFCgYtZOf41Fa6yvn8=; b=NbUV3CLy7XaQJpakeLTkX4zmIoR0wPggy2upBFmdeBNqca2n0HJU7YRYgMxThdFIxD 3zAWmB5MdptDx1FmMpZoJ0QDkW+Twxk36LWKkh0zTcz1/nMjgyASuW6VFQox1E7mNIy2 l0VCLlZywCoN4RS6deEGViquQZJzMih+qkbt9KL/VCW/b8xBjS7bX5ZWzkr02xKrXkSm uQ5LOrNl8fNuF76qVOmF7LhJx1AQ7WtQ/YGrfkovyPQzF9J8pQsKFHbPwhvdqkWTEQs/ Iu+G7FCwON9uY7zBzOZg1YiLsSpsEAr09+tUD8PnpffuK0XLEbo/FurMSjpeR36LYaeB ONiA== X-Forwarded-Encrypted: i=1; AJvYcCWKJUOP5eBMXb8W423vLQiLd95/6hDR+5wfxp7jFPAFQFQAQQYmzLxkcV9fU9Woj9SxRogIIiHB6A==@kvack.org X-Gm-Message-State: AOJu0Yx7XDFmO0gm/hk6n9OpyJhxCUUGUscRAsv2iED/3i6we8BAvJDq AVG0TOiAG2Baj3lAvwcX/IvWvOqf+/Nc2WMECxPPTC4QL9YIdsrk X-Gm-Gg: ASbGncv6RXuqM8GF9zwCDdHg3kZpGppFUpCnwGnbkCduZG1jCvgEC0yScot4yg8sxj5 Muk1PwmcefXiwzQ6xplqlkbJCZMS3aaTUs66LRPcGB+tjEIDJqNkdVnLHzzaYPW8Yx6QsRkn8p1 5BIF8tCusKJVXiTPnmYnKzeH++uvdw3flmN2SVZNZLdPXBzpvVIJ0LWgnaLa26WpNstt1QzTJ4f nXeETGPVNXDx8mnGqPnhuE14hiduhX+FR2z3+3HO3SrSoCz4MmM91KJ+hoCCysI2LY= X-Google-Smtp-Source: AGHT+IF8E8faLy/AkhJpKHn5uguKgfoXbmLpv+0a9fNgAJAqK/Kl4a6e9pElkLit8Z5sWpgLlssJmw== X-Received: by 2002:a05:6a20:c891:b0:1e0:c432:32fe with SMTP id adf61e73a8af0-1e1dfd87731mr17176399637.26.1734361542256; Mon, 16 Dec 2024 07:05:42 -0800 (PST) Received: from localhost.localdomain ([1.245.180.67]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72918ad5ccdsm4845518b3a.74.2024.12.16.07.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 07:05:41 -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 11/18] mm/zsmalloc: convert reset_page to reset_zpdesc Date: Tue, 17 Dec 2024 00:04:42 +0900 Message-ID: <20241216150450.1228021-12-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: rspam10 X-Rspamd-Queue-Id: E3C7F180019 X-Stat-Signature: 4bg37cfiqntwyi5ocq3z99uwmnbgotw5 X-Rspam-User: X-HE-Tag: 1734361539-201765 X-HE-Meta: U2FsdGVkX1/kseGijgqgD51CZG207oluDE+tLQslqZrvkas4MharRDzPThwBPs4JRyZxuhoeWo85Ezx9GjXhrvj0Od6KY8bRACu/fCKtJgqzl03qz56VOI3jdclNy6ubM+JFuYZC9n6UvIzFUrDHV1qf4OYYFmBHxnVMHrRwk9xi6XnySbueWrrV7ypK9e5Zok8OgZL2dWsFShMarh6Jbx6hVvME+rnQP/1UtVCDfCMfj1NI6qf5s7U2YeDud6QVt41/5/C1nlWC6J8od4mJjyhlzj6cd4OyAKBFkRPctFr+8IhORrbEKCsi7t98ozCaIua1BShf/5yAcaYe5ShbCpSWkVDHpaORS3AkcRxDyowkS9P/tmRq+QAL817sVCEDedTT12Y+yaSHgvY1r7nzHfK8PRlEjnASXZ14iB6RvUgTuXTS+xprVmc2AdkiuOIuJ5RbIJLl0ztgqyMxq8a/ipuGoHFwhsGiS46qz1pJyLnZWskdhLYbFWv5HqP3MIdSRojuRNoQnsA0yWwiiCggZx8IBrgQfNIemudbq2HKPkvlaZgeoVANEVCpGFRHQlHdd3d6YvhQjWZb8ZZeNdRrBHM/UMEdVfj1uLKJC+W/5m893CHgPK5yugB7SApeiunueyVZj6LifbexjKpO+1OUGWWS28OGvUUUSK4i6sJDNoDg1dFqYAm2QWRZ7+SPxw0tC+n/QPHv0aqB6u44rgjw6X6uWttcLBYeSkggOaZsreLPmS/SiVZvkzK2gyZffZYAVVLSwpjXF58jCoB+qVdrV1129N0prF00MkBSNx6RLEwmT/SjKeYbPkRqGTmjLkplmOxYiQUgKTe1XSyY0zqU88Z9a4g6eJ635pLdEHmngPrqq4KO50YcnnNpzF/5GmozreoJgBytn2+qas3vb4h88tELShvlVccNtVxeKjS5mBHmiGzOhzOrkjGfD4i5PacZfvXg587QkmOAgqiAfIR NwUNPGxZ k73kW3gADmfHYzvQOcMcLiPFnlEzT3i8OrB9fk25/+kzULNc5e+m1p9jrOV7PIP98D36LLPZxZv18FyBsiHMZBvGTbTWgYe2URcDHI+575JagUVU1L+p4WJEQekXo2vrrOdReXq18MZYr6LkZd0nepHuTyZPhaMhJfcz22QhCHNQGpIYciapZdW3WtUVsL2JTTnjosMeNqAwJb2nhmE2plm9mf6weJDW0DyAXVSOxmZOoNrDM5zw2128L1P1JYIl4eqtIMHYpN/KYzG7ug0mJMnprKMId84gZnS3iqMAQzohzNbrPRM22yTxJnhtPneMpg60oc/G34SUqbeHEwBcCHig8eguH/YELzdG+bKV3cVvvJpZ3J9J8AB9z2lBErikI+1lIeB1hw5j8RIHiyFPkeEHAuKAj6SncDy5nqc3qNWJfw3cTI7CChzF7SQCW41H5/HLw2SdvM+ZyoLWDTrMECL0/zRjV85ezORzOH+UA0sGIfxg3tFbSLS8M44u9loiCi0xdbsxOjGyj94fzypIZrqILHVv8xEMoVLZkRe6kSsOed3s= X-Bogosity: Ham, tests=bogofilter, spamicity=0.336703, 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. Since the fields that need to be initialized are independent of the order in struct zpdesc, Keep it to use struct page to ensure robustness against potential rearrangements of struct zpdesc fields in the future. [42.hyeyoo: keep reset_zpdesc() to use struct page fields] Signed-off-by: Alex Shi Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 432e78e61d2e..dded6d1f3b7a 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -843,8 +843,10 @@ 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); @@ -887,7 +889,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); @@ -1865,7 +1867,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;