From patchwork Mon Feb 20 13:22:06 2023 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: 13146441 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 AB152C05027 for ; Mon, 20 Feb 2023 13:23:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A2896B0085; Mon, 20 Feb 2023 08:23:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 452A96B0087; Mon, 20 Feb 2023 08:23:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 31A8C6B0088; Mon, 20 Feb 2023 08:23:12 -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 220766B0085 for ; Mon, 20 Feb 2023 08:23:12 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CE8A61C5ADC for ; Mon, 20 Feb 2023 13:23:11 +0000 (UTC) X-FDA: 80487736182.28.7FCC9C9 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf06.hostedemail.com (Postfix) with ESMTP id 163E9180009 for ; Mon, 20 Feb 2023 13:23:09 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=oF9MzcS9; spf=pass (imf06.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.51 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=1676899390; 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=skPYHHyk9Yo0IJ84h1UwW/puUpVZ+zGk7cW6Blw7A5M=; b=YQpQBUUi5mG7x7bR0ofn1sO46ZhbKHh+ge5xt1zqn3WZ7C2yhssXZh69TpaCdI6XrYX908 48+VjbG+ip9EetT/VO46/K8XuiU5Zj4ewHEJ6KxvzvwEo+0/pfuKb2AxT2KwdjyZFqaNlt vA95JW9HpQAzk2Bv2FVh/+R4mKnnqlg= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=oF9MzcS9; spf=pass (imf06.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.51 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=1676899390; a=rsa-sha256; cv=none; b=PggmoQyMTGApsVm+7MP5iOK8bE5g8tooUUv9Av3lnsypZfNim2KwZXdPCM7frLQwwpJjPh gSg3vRaY/8+zpGf62j9L8a6gHzNzvv0Jm9ZfKY/UcbRBiVk2SiJWq/zLxVVXQMnPazWsjr de5wCsibpuCpBFSjj3+9jbikyUBJWw4= Received: by mail-pj1-f51.google.com with SMTP id f9-20020a17090a9b0900b00236679bc70cso1996664pjp.4 for ; Mon, 20 Feb 2023 05:23:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=skPYHHyk9Yo0IJ84h1UwW/puUpVZ+zGk7cW6Blw7A5M=; b=oF9MzcS9ENBjt29HMPV1n/nk8XiVP9agjdzRoaL1wM0BCkz02qkAg4P/MScDtYHwCB ub0QLk5TjMdCzysoqLUtt4GaCBdbUEFGBwiZQEsBoG8Nt0CP5XM8EYvqnt+UqiUM5g/x qfSoWTAfir6v3Rho34ytd0gMNQLIwxSRblO3OSKIPo8rw5iJP6HGvdO5VGiXH/1TiL9p qCgFIE/RzA6MaBEGpY6HjijIcyd1doKw+UxGUtU3j/UGjAwkB/2spr4Clg6DM9mJdq53 EyIWtAC86KWxB3lN+yDktOhueTHezSLkznKoh6Cc41Oka3GoHViipll+QbJLLorJ7iGK 6Lzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=skPYHHyk9Yo0IJ84h1UwW/puUpVZ+zGk7cW6Blw7A5M=; b=MtQXSWYrAwjZ43m6HvdJ5yD+36oH9z+aUtGk20KCuiKbXC/eL8q7bHpSX+ZixkeaIc HcCpqMzhwLEkxD0F9x4Sx2stBUy/qOorpbRPxipbTC56KuNvLi/ZTA0Bq0J3KsN/m3Ky SP6wrQKe5NpM9JAVg2ez9LgOdbCQZP1Itzd740IuWQfQnIQbsoBDdiHltKF2O1mf3LSR r5O2UF/BI8rf6Huw+ulgD54Gn3KtDIrwsE5HIxa07uLCLPlzzh3tQWXnZJEnVCweDeLR uTkdk3mkCPYJ5nYBfybwoH+IxTaA6V8chnF2w72INqGXyL3nXqnlgZG3UpWNumMuJT+t jf3g== X-Gm-Message-State: AO0yUKXlzK2b0t3JhKMEVNQGxGRXza70sYIHbIS2CXd6juCfrqR6YWL/ 0CVsGwZAqUSJ1m4PXem/XFHVLFbCrOpFkQ== X-Google-Smtp-Source: AK7set8i/vxJ3dWT6HLlF94AAlPv4ZnX2RcMzCeKzs5zhcsbWokaEo1iWWMNvRRjt108I9QB3gftJA== X-Received: by 2002:a17:903:1ce:b0:198:f1d0:f9fd with SMTP id e14-20020a17090301ce00b00198f1d0f9fdmr3860970plh.27.1676899388951; Mon, 20 Feb 2023 05:23:08 -0800 (PST) Received: from test-ha.kr-central-1.c.kakaoi.io ([210.109.63.229]) by smtp.gmail.com with ESMTPSA id x2-20020a170902fe8200b0019c13d032d8sm6125436plm.253.2023.02.20.05.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:08 -0800 (PST) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Minchan Kim , Sergey Senozhatsky , Matthew Wilcox Cc: Andrew Morton , linux-mm@kvack.org, Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [RFC PATCH 13/25] mm/zsmalloc: convert reset_page() to reset_zsdesc() Date: Mon, 20 Feb 2023 13:22:06 +0000 Message-Id: <20230220132218.546369-14-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230220132218.546369-1-42.hyeyoo@gmail.com> References: <20230220132218.546369-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 X-Stat-Signature: 7ok7mmysqfkiqx6mswkwd9hfo7ir767h X-Rspam-User: X-Rspamd-Queue-Id: 163E9180009 X-Rspamd-Server: rspam06 X-HE-Tag: 1676899389-760195 X-HE-Meta: U2FsdGVkX1//CJVaoTULtcfQ+NC/80uGKCm0Q/R/nZ0VFIfq+KJNfiwB1G6ppy+BdbSs6fH1/TTh0Kjmk/oQV6CF1EquaY5TGAkYPOz/UgO5RdWtF+97YyFy/xp0pkK1ZClit3hjMY5MigIY4kRftTXbZH9FQ/WcY2mEVu/VShR3aiTL42uqxRO+/zFLIlOSFmT7I0xipObsCUsvYJTmNvAnU2IKpwxCxOptENx9RHIpjdNQgDkxSDndEj4a6z2kaIoV1TYa3zlsvjkHi4aegwgbeCRRlxtf9Xl7YRipoCmTPcKaagz7yXmgLmsPP8zSYAX9jTgNP6Lo/2OOzVEpSB+EV4G/6heA3jnnZgMyadv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qVkhwUjM76vyMRAoVB2/2rOq3TIEtm11R6I8D3xzLObVimFjl5g0m/0WVLdl0FiipVSJeiNr0M28WcusIEc/6cGomNOk5H/aPflMqe2Rw1ZAZnlq0A57NZHrFUUMYBn6QqQ1DJmUAsHvy99U6N+pENR 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: reset_page() is called prior to freeing base pages of a zspage. As it's closely associated with details of struct page, convert it to reset_zsdesc() and move closer to newly added zsdesc helper functions. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index bbb65fb8749a..5a3948cbe06f 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -450,6 +450,17 @@ static inline void zsdesc_set_movable(struct zsdesc *zsdesc) __SetPageMovable(page, &zsmalloc_mops); } +static void reset_zsdesc(struct zsdesc *zsdesc) +{ + struct page *page = zsdesc_page(zsdesc); + + __ClearPageMovable(page); + ClearPagePrivate(page); + set_page_private(page, 0); + page_mapcount_reset(page); + page->index = 0; +} + /* huge object: pages_per_zspage == 1 && maxobj_per_zspage == 1 */ static void SetZsHugePage(struct zspage *zspage) { @@ -1080,15 +1091,6 @@ static bool obj_stores_deferred_handle(struct zsdesc *zsdesc, void *obj, } #endif -static void reset_page(struct page *page) -{ - __ClearPageMovable(page); - ClearPagePrivate(page); - set_page_private(page, 0); - page_mapcount_reset(page); - page->index = 0; -} - static int trylock_zspage(struct zspage *zspage) { struct zsdesc *cursor, *fail; @@ -1164,7 +1166,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_zsdesc(page_zsdesc(page)); unlock_page(page); dec_zone_page_state(page, NR_ZSPAGES); put_page(page); @@ -2269,7 +2271,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, inc_zone_page_state(newpage, NR_ZSPAGES); } - reset_page(page); + reset_zsdesc(page_zsdesc(page)); put_page(page); return MIGRATEPAGE_SUCCESS;