From patchwork Mon Feb 20 13:21:54 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: 13146429 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 80171C64EC4 for ; Mon, 20 Feb 2023 13:22:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0AB7B6B0074; Mon, 20 Feb 2023 08:22:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0350D6B0075; Mon, 20 Feb 2023 08:22:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3F346B0078; Mon, 20 Feb 2023 08:22:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D6A686B0074 for ; Mon, 20 Feb 2023 08:22:39 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8F410160331 for ; Mon, 20 Feb 2023 13:22:39 +0000 (UTC) X-FDA: 80487734838.12.9980665 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf05.hostedemail.com (Postfix) with ESMTP id BD968100017 for ; Mon, 20 Feb 2023 13:22:37 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=pn6D6oHP; spf=pass (imf05.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.44 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=1676899357; 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=SyI5UBLGHCPpade/daMIpbi7gnFelltbgYK3ypTZA7o=; b=LLmjgCaJ9CInaKnuaT3YsfI5ZBCaG9StctxcTlUX9ygXpyaao956SHVuCuFcQAMY0CUIpv 9BTUexXtP7qpGsZvR0bGw89KsYBU5Y7Sep4Ufp36ThJhVv45oOHC6Rx+QDo8373UEg3U/3 rV82dZCAXdH0/67WdcUecrNTP7mxFjc= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=pn6D6oHP; spf=pass (imf05.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.44 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=1676899357; a=rsa-sha256; cv=none; b=RsLU6Uvqi7E5xv3+Ie6vtiHK1+OlX6UJyLDZaEOtulxEVzsbyGS8L26w+mt0CNu4+iIvh3 kaLnbGhmKVrXZkKLjhuNpRf68W0y2JhXhchg2dtCvZhGSvtzq0zRiDYqXW4XgBIfXyFWPV uRkgEjCv2wUwJ1GWuCm+gcV0nwu7rkU= Received: by mail-pj1-f44.google.com with SMTP id il18-20020a17090b165200b0023127b2d602so1441779pjb.2 for ; Mon, 20 Feb 2023 05:22:37 -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=SyI5UBLGHCPpade/daMIpbi7gnFelltbgYK3ypTZA7o=; b=pn6D6oHPX+xMRyXM3iSn//UFTBloJ3AqSwCf/EzSLd9H+TYt8nlSS8FsHRALgywjrn oPQxL+uC0Sc4Jf9dBF7vmJYW3QeA6Zq6aEBu8Fq5MTxgz1Qi1pSBS2c+0vSrlNosWQ1L J0WfBAfSIdCAqiYKfzk7vVK1RI57OOIqJZYGqnPsc7z+yZZumbtqGinTjwrkmxHvf/0F CPAZFqOe8o9q0mnzyqVRn6Qyk2ba9fS9ao6m4ywNh1Y0kTzVktRncfWXJPS7ClpCMyaJ flYvgMZGCtN5pYYy8z1FHjH3PlyZS8t8lbYmvkrDaG2+d0Xj1N6ygmJlMzZ/vtXDkeaY SzDw== 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=SyI5UBLGHCPpade/daMIpbi7gnFelltbgYK3ypTZA7o=; b=yDckTjneCPzhB0k1/gAscWnS489OSMoyfOMxoA5NWew0jP8Fn0/2f5ehSqPY4CzaJJ F/TixHifojxCxIPsTnnVW6csybEkeifdw8IXXYpxMsXTqn7I+SCuQwmp5+U0P4ZPC+xu y29vjjT0qIVB3ohzTALrzN7SS4nJYIc7jzMnyvBu0/jeDKC0NX1Lw3Qr6BGfSeyexs3a 6GNvjGMkuY45imnaRQriOhFvhI2ufkKjllJHeKf/YOfYB7N16DzAJAOFnvh9jR+XOelh Ae7UKDg6o5eKK0O6z+QJs7jJpyH1JiVkNNyPKcMvHq5T7lO1TIu13u6a48/oJZOAUcQ7 RG+w== X-Gm-Message-State: AO0yUKXFEbNslNGiAfFYJYY0SnKqf2vq0f0IZWjoar10ezZVj0DvEf3N vEVF7FW7M6P5lMErOwaEAqc= X-Google-Smtp-Source: AK7set92kAEEjQDSSqAJ0JvhyLjfPKZceHVt/Bl4hw2AqNzFqv6hCJJ4LaGS3DJpsfn20LKslqtSzQ== X-Received: by 2002:a17:902:f68e:b0:196:7bfb:f0d1 with SMTP id l14-20020a170902f68e00b001967bfbf0d1mr3694194plg.34.1676899356321; Mon, 20 Feb 2023 05:22:36 -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.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:22:35 -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 01/25] mm/zsmalloc: create new struct zsdesc Date: Mon, 20 Feb 2023 13:21:54 +0000 Message-Id: <20230220132218.546369-2-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-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: BD968100017 X-Stat-Signature: 3n1citfi6prda53cqow4goymdmtuzwyt X-Rspam-User: X-HE-Tag: 1676899357-987979 X-HE-Meta: U2FsdGVkX1+wL8IEEwXR4cgcXQQqULLODbVMHUQwrasWZBYRn7lCZg48fV+9rmRdBHAEEeZT95JM/n1oU7/6xYYSPmnE/HXRIEkEyPIhFWcEMNkyAiKaGjd7AQ4fMsISqZaEb92abCxqFP8iYuOfk3YFqlbTEkljKnVZxtQ9/XecYyFfA6kMt7M2byqYIVzD7NHOropKQWYfJRgJsEzVxvQsLcNr9qOpVVHTkkebDQk8PJiK2EHgBtkgUtZRwSbO5K5+osMcvpT7XPQwOqFL7DcYsBW9EhyUEHthTYuA4Q9gB8iK8dHqAHXy6ZGsytbiobdq6fVr1cddl1kmYhjrZYa1XW0gAmKa+vgpgYi2rgTy2Xlt4QxiwRb3YvhJZJ/w39EXIcGMNb5UUH+cOVUagV53Bl+4UsyD3lGn+a4KymGDfeGv3aIHEq2htrP/BhuIko4yCmNf+Obv1SUNjGb7PLy64E42rzaRtQ/BFaVz7mBsxFx/k2DLIKtJ2szKPFe4lYPomyF0tEBAO9vQEilcqsL2N+uOkFkyyZX9THc8zuz9HlJKmr8YYbCBq8h8EW4pHBbZU3doBXdmKiig7eNrM8vcLJ1qhumrLM7Sn3hYC1WD2WgZ5PvadoVJSg9ZSRtzwIuRH1rnMTV67yM6mD40by6x1pTv/cms8y/TbvN86SZZtN3AkysUEbFh8uSHDlJFnrQJhRiBSUqI8COt2pqI65TLf6Txdk92XuKRjVD3Q7v9A8gAlVdX5M/T5hxEcg9ZIwJ1tZ6qoHNmGVJdy3vCCVcPraAbY9muqMRqC9XhnYYx8P5ReNaHVT+jtPz7MtkYI0ACRbjBRRvHJX7bqpAV3txyMK+1hU454Bcl7u6ZiQ9bUoQhEpf1qre6NqYq5SQPWkhCfO1xCrGHLAasfyTlAQd6wXK2ZATJAvP7G8oUL+oaFUo/2WQiNHAB5+RaCVObWb4/r5WdfibRQ2J+7rJ CLVRGhlt mcHcS/Bxs6+tbenwIOV2CKEOcvYqcizPaspWfZgqqDC4SmJ+YiNVDsAviIiTk+fY+hOgeNaJdFEdDLQwX88j+SRzRyXA2WX78uk6LabPvG+TDhptGtJyP8ufZfmCvY9FQKrZWofxNfkZslPO4JUO+v/Mq71cpj9IeiM3tE+IYQWTm0X8I5fE/lF1nYMEUDNAwsBI0gGvA5IH6kEqVpiesCh92embprIk3JEwCnVJwb5wwyqMHbiWsL/lf72MRKek/7pZYlyQGVGFO2b7LscMVWnN6wTQoJa09lrFIlBhJkxOhcCjk13V8tvtCyKNbKUCrEVTFNl5WBVzekS7bfvW+efWDQXZPSvOHCRBgvm+lvRt28D/hMP+K2UywyHaUFFcMz6MdPOImrR+EDNDmnOLycbFUEik5B4FIO3RFJfYE0svrQd4mpVLTY3CluZfMKdel3AcmdnVqUaZdRgZHVQWmPTZJ7G/4WgnpcdsxoypuzDZztxf2Yxx6hn+Oqb6ZUXUtRNBorYDzgAioQioMutkaWHSkp6ygs78Q36CHYV965xX5On2XJS0mUfgX0Q== 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: Currently zsmalloc reuses fields of struct page. As part of simplifying struct page, create own type for zsmalloc, called zsdesc. Remove comments about how zsmalloc reuses fields of struct page, because zsdesc uses more intuitive names. Note that zsmalloc does not use PG_owner_priv_v1 after commit a41ec880aa7b ("zsmalloc: move huge compressed obj from page to zspage"). Thus only document how zsmalloc uses PG_private flag. It is very tempting to rearrange zsdesc, but the three words after flags field are not available for zsmalloc. Add comments about that. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 63 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 3aed46ab7e6c..e2e34992c439 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -11,23 +11,6 @@ * Released under the terms of GNU General Public License Version 2.0 */ -/* - * Following is how we use various fields and flags of underlying - * struct page(s) to form a zspage. - * - * Usage of struct page fields: - * page->private: points to zspage - * page->index: links together all component pages of a zspage - * For the huge page, this is always 0, so we use this field - * to store handle. - * page->page_type: first object offset in a subpage of zspage - * - * Usage of struct page flags: - * PG_private: identifies the first component page - * PG_owner_priv_1: identifies the huge component page - * - */ - #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt /* @@ -303,6 +286,52 @@ struct mapping_area { enum zs_mapmode vm_mm; /* mapping mode */ }; +/* + * struct zsdesc - memory descriptor for zsmalloc memory + * + * This struct overlays struct page for now. Do not modify without a + * good understanding of the issues. + * + * Usage of struct page flags on zsdesc: + * PG_private: identifies the first component zsdesc + */ +struct zsdesc { + unsigned long flags; + + /* + * Although not used by zsmalloc, this field is used by non-LRU page migration + * code. Leave it unused. + */ + struct list_head lru; + + /* Always points to zsmalloc_mops with PAGE_MAPPING_MOVABLE set */ + struct movable_operations *mops; + + union { + /* linked list of all zsdescs in a zspage */ + struct zsdesc *next; + /* for huge zspages */ + unsigned long handle; + }; + struct zspage *zspage; + unsigned int first_obj_offset; + unsigned int _refcount; +}; + +#define ZSDESC_MATCH(pg, zs) \ + static_assert(offsetof(struct page, pg) == offsetof(struct zsdesc, zs)) + +ZSDESC_MATCH(flags, flags); +ZSDESC_MATCH(lru, lru); +ZSDESC_MATCH(mapping, mops); +ZSDESC_MATCH(index, next); +ZSDESC_MATCH(index, handle); +ZSDESC_MATCH(private, zspage); +ZSDESC_MATCH(page_type, first_obj_offset); +ZSDESC_MATCH(_refcount, _refcount); +#undef ZSDESC_MATCH +static_assert(sizeof(struct zsdesc) <= sizeof(struct page)); + /* huge object: pages_per_zspage == 1 && maxobj_per_zspage == 1 */ static void SetZsHugePage(struct zspage *zspage) { From patchwork Mon Feb 20 13:21:55 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: 13146430 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 D2128C05027 for ; Mon, 20 Feb 2023 13:22:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C7976B0075; Mon, 20 Feb 2023 08:22:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 69D006B0078; Mon, 20 Feb 2023 08:22:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 516B86B007B; Mon, 20 Feb 2023 08:22:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 43C6E6B0075 for ; Mon, 20 Feb 2023 08:22:42 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 1C4FAA0729 for ; Mon, 20 Feb 2023 13:22:42 +0000 (UTC) X-FDA: 80487734964.19.F6A6DEC Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf22.hostedemail.com (Postfix) with ESMTP id 27ED7C001D for ; Mon, 20 Feb 2023 13:22:39 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=UHdrxgrp; spf=pass (imf22.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.181 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=1676899360; 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=25ubEDcvqtlbcUDXHLpY97pPX3i6N2AmkqsUOsE/gOw=; b=Y9AMAGlHPSCR1+V+4JrA7hWXPYadFSM3H3LIZa99AQ9jptxeMD09Z6ASMxEZFiu0vmGxcf wwlLPN8IHRVgXcyeKuI7igqfuSd9GQf66eUQE1x15L2k0lt2luWi5357K18hB7mzANeHbi 1MMIdyPuWX/gVC3nZGuRRfd0DIKucdg= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=UHdrxgrp; spf=pass (imf22.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.181 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=1676899360; a=rsa-sha256; cv=none; b=Cav6vl/60DNJ9+HawqLPtSGxrbQjsA0h/+zT/8PSHSb0yDny8uY+HfzruwMc9ukMcqOCFo rcwlSAPaFetkTzmrtz6q0BoWecrBXcCBzEgT6azNNQeGb6Njs6MikgOu1Y8KRHYZAklEJE CLqn6xWl20XmvhI9Yw1Wyjb/HC+5WMk= Received: by mail-pl1-f181.google.com with SMTP id e5so2394261plg.8 for ; Mon, 20 Feb 2023 05:22:39 -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=25ubEDcvqtlbcUDXHLpY97pPX3i6N2AmkqsUOsE/gOw=; b=UHdrxgrp0IvrkOTYA8RHpGNZwTil6H3+a5XqSpKvvLyLjAKezper0fnx7g+T9GvQ38 ipy1Ezf8kJh5e4JaUmc/8aRBf+cXhPijYy3zfUCbEzb1jCxVUwwFFUgeJSjQ+qNmM07T /PRKVVE5e6IFNsAGnVFn5bMxiBuySHcWgnSN+5n2Guv6V9Pt1zhfC0sik/ldEpoy8+gP k00bLezTq8096aQR9R9ktxnF4kJzVRicD4wcXaHJh0z+BY6sBv+/xpvqVYe3WcyIUnc8 o6aD61EPbZKuPLcc/bUc07VPDMg77qKBTeD/fGxr7xldMq9JuFvETVTNiqVwIZ1xJuWd JOOQ== 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=25ubEDcvqtlbcUDXHLpY97pPX3i6N2AmkqsUOsE/gOw=; b=f7vwJzcDSDbs1sYZjqPJTviEwe6eJ9SKUMZu2qXCpjaVbv5YEUKOkFYTgS4si5hnwd y4FJb2N1BtkLMfLV8qqFbo7/VJwEtYv2jQ0SmcrmUZJ0u1yx8rHKDCX5UeC1ai3reSYv 2gu+n4CDFcWjvngYDYq3lRdopK6702tZFd5dWgRC6L1cMocfIBBzJ382wRBnsc00YnUU heBuZ7KezcG/6neicd7dLP1hWdP1ib12VvjVW0epAOdr5FC6EdKVou4XOXQMBJgd5zx5 9sDOilbF/Z/SiOChZ2rinkyJk6TW9Hwy0Jh1DF2DWPwjqnk3XjHzlQtcd1RGppwSiH0z 4AkA== X-Gm-Message-State: AO0yUKX8oUCPvKArqy4eW9spmgGndmQrVwTxuHyRfmpl1oWdso3uEAmJ YnAkrkFCI9OVPygso2ALc3A= X-Google-Smtp-Source: AK7set/aXrtaYVuaiGcteULWSBlZk5B6OdOOxkIhfg+8YJr/Tj4oZzpeX2CVCa+OiINayP9Kek5VqA== X-Received: by 2002:a17:902:eccc:b0:19a:74c7:dcda with SMTP id a12-20020a170902eccc00b0019a74c7dcdamr3271176plh.15.1676899359025; Mon, 20 Feb 2023 05:22:39 -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.22.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:22:38 -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 02/25] mm/zsmalloc: add utility functions for zsdesc Date: Mon, 20 Feb 2023 13:21:55 +0000 Message-Id: <20230220132218.546369-3-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: we5x97bpcdadg98zrtmp6ppb33cc3s8b X-Rspam-User: X-Rspamd-Queue-Id: 27ED7C001D X-Rspamd-Server: rspam06 X-HE-Tag: 1676899359-672095 X-HE-Meta: U2FsdGVkX1/fZu8Hv39zJ/SxiQGe7yP9bnNHZDWK3dK0vsgbvhPOWsg4ycpvNayBQont+DGK4M9/QYEq2ztxMpQQ5pERLwkBZYDoNSqRXKvcmfgaQDMZyOW/TMOZGyR8A3gIpa1mrol/7rKHxaGWm+73J61KVw9z75R9K5wnBxcJhnoKSllDkd0FIDpCHVG0wCHqa5FNyHCx1P9Rn7TALOSKbJKLFLmzV/F4otf3NUeg1fxJVx3Mduw0OsG1CAOw0NFvjV9KcVxQ/QPdDIrm3cOLU1R4JI/lUHvDvYGO06fdetXYTLimO1X1SRpjoy6Hx/SzeQeTC8nkezzzG+DWszN6Sue1grPP+MpQijBSt2MmUSHcA+4mTT6+USbapZnauGShTsuVOCp2bqY9SuIoa5WKAl4RlAAlC8qYyW6vU6LZhLLF8iFaT7hYdQyFdAOfAkm5SCjhTj5MbUDBiToNKFYfnPZVZFVZgzW6JGfCOCPFR7DqPvvpYYjobjylizytI2nBwNMlSUpkMiOoedUEBNK3s/khCXKl3MYR+7UdiYG7KnJHgP2DE6LZJ695ZUXMZ/ShVOeq8IXVvFUJoaTEZxZWleRIgSwF/edkEWFiMzM4R18zPXZniBlNJEaCKAgIui/v6KjuSpXkyZc1BkNQYCUh1hGYzT6SrqDR6caSJ7ryp6ZUqOFW6wopLy5u2CryDJgyAM0wPn3awv24pqRpJ2HbqmcnFG33YVS47677hPxac+p1cTdF2l6VipiPrmENpWJG/HagNREc1DTDJjGBvUjlQ2nNBJ6BYYMPe/LYWuP2jq5ttc6qtL3kpDaI5jWdxq8wSZt3OQpI+gXIt3fnhZBPOWSqExDE0ouASnQtdBkkhZU0m/yfNM7zTfUIl4ZUpDE05yU8/v7fevg1ynqTxWgSh0ESXY09vcBYN0V3y6vHHdhRK6icPXfVLdu3GBQNGhD9TilJ1LfowHzT/1j vfLWli/u pzWUz0Fsz7x1q2vw+uArlx7FZt05UcSn/f3iH2phVIgb/cMbLtOwKW/j8a0W2evWC+ta7ie3FhOjWU/g6tmRoiN76KUGaR05e+hhbVexRmuvvRm2T/OxwNfVPBWJq8g5DpKjiIoseZpl7oUmuN+mRyp89uRBbKHugoCbVYFGvtoqtlhb84dlQmcBrYWGSYwTwX6Ck/CtPx5Lmtx5Uz4ZYt3vwUjD85jwq8t/cg+Fv7vIKDY5sg/qj8s/8mcDbO+WhxCZfT+oK3KIpttqJ/aH/Ck6RIPOIVIaGmcKMa7rc/Xwdl+tyaltYhsq8WxMR2RaJq7goFDFbdsA0usbwADxo8rHqoaEL5j3Es4exXOLeRhOdVMB2/oBg5f/CIaOstZ+PazBS+E263OjGVnO2I4cX/m0CkupQ9kGUiwPpcvnfSEtnrjFNdvhu+6WYvpNbaxfBOzpmfWwK3v2KfyW0ZLuaXzSl5IJchUC4959lLav+9iBLCmoFRtAFpNMwfaRAFM2D8EBqkETHSEX8aaOzq0YzP/Y9uZyyLCkAxIrhtmt29PfWINupwKhiRfMw4Q== 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: Introduce utility functions for zsdesc to avoid directly accessing fields of struct page. zsdesc_page() is defined this way to preserve constness. page_zsdesc() does not call compound_head() because zsdesc is always a base page. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 118 insertions(+), 2 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index e2e34992c439..4af9f87cafb7 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -332,6 +332,124 @@ ZSDESC_MATCH(_refcount, _refcount); #undef ZSDESC_MATCH static_assert(sizeof(struct zsdesc) <= sizeof(struct page)); +#define zsdesc_page(zdesc) (_Generic((zdesc), \ + const struct zsdesc *: (const struct page *)zdesc, \ + struct zsdesc *: (struct page *)zdesc)) + +static inline struct zsdesc *page_zsdesc(struct page *page) +{ + return (struct zsdesc *)page; +} + +static inline unsigned long zsdesc_pfn(const struct zsdesc *zsdesc) +{ + return page_to_pfn(zsdesc_page(zsdesc)); +} + +static inline struct zsdesc *pfn_zsdesc(unsigned long pfn) +{ + return page_zsdesc(pfn_to_page(pfn)); +} + +static inline struct zspage *zsdesc_zspage(const struct zsdesc *zsdesc) +{ + return (struct zspage *)page_private(zsdesc_page(zsdesc)); +} + +static inline int trylock_zsdesc(struct zsdesc *zsdesc) +{ + return trylock_page(zsdesc_page(zsdesc)); +} + +static inline void unlock_zsdesc(struct zsdesc *zsdesc) +{ + return unlock_page(zsdesc_page(zsdesc)); +} + +static inline struct zone *zsdesc_zone(struct zsdesc *zsdesc) +{ + return page_zone(zsdesc_page(zsdesc)); +} + +static inline void wait_on_zsdesc_locked(struct zsdesc *zsdesc) +{ + wait_on_page_locked(zsdesc_page(zsdesc)); +} + +static inline void zsdesc_get(struct zsdesc *zsdesc) +{ + struct folio *folio = (struct folio *)zsdesc; + + folio_get(folio); +} + +static inline void zsdesc_put(struct zsdesc *zsdesc) +{ + struct folio *folio = (struct folio *)zsdesc; + + folio_put(folio); +} + +static inline void *zsdesc_kmap_atomic(struct zsdesc *zsdesc) +{ + return kmap_atomic(zsdesc_page(zsdesc)); +} + +static inline void zsdesc_set_zspage(struct zsdesc *zsdesc, struct zspage *zspage) +{ + set_page_private(zsdesc_page(zsdesc), (unsigned long)zspage); +} + +static inline void zsdesc_set_first(struct zsdesc *zsdesc) +{ + SetPagePrivate(zsdesc_page(zsdesc)); +} + +static inline bool zsdesc_is_locked(struct zsdesc *zsdesc) +{ + return PageLocked(zsdesc_page(zsdesc)); +} + +static inline bool zsdesc_is_isolated(struct zsdesc *zsdesc) +{ + return PageIsolated(zsdesc_page(zsdesc)); +} + +static inline void zsdesc_inc_zone_page_state(struct zsdesc *zsdesc) +{ + inc_zone_page_state(zsdesc_page(zsdesc), NR_ZSPAGES); +} + +static inline void zsdesc_dec_zone_page_state(struct zsdesc *zsdesc) +{ + dec_zone_page_state(zsdesc_page(zsdesc), NR_ZSPAGES); +} + +static inline struct zsdesc *alloc_zsdesc(gfp_t gfp) +{ + struct page *page = alloc_page(gfp); + + zsdesc_inc_zone_page_state(page_zsdesc(page)); + return page_zsdesc(page); +} + +static inline void free_zsdesc(struct zsdesc *zsdesc) +{ + struct page *page = zsdesc_page(zsdesc); + + zsdesc_dec_zone_page_state(page_zsdesc(page)); + __free_page(page); +} + +static const struct movable_operations zsmalloc_mops; + +static inline void zsdesc_set_movable(struct zsdesc *zsdesc) +{ + struct page *page = zsdesc_page(zsdesc); + + __SetPageMovable(page, &zsmalloc_mops); +} + /* huge object: pages_per_zspage == 1 && maxobj_per_zspage == 1 */ static void SetZsHugePage(struct zspage *zspage) { @@ -2012,8 +2130,6 @@ static void dec_zspage_isolation(struct zspage *zspage) zspage->isolated--; } -static const struct movable_operations zsmalloc_mops; - static void replace_sub_page(struct size_class *class, struct zspage *zspage, struct page *newpage, struct page *oldpage) { From patchwork Mon Feb 20 13:21:56 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: 13146431 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 9A1EAC636CC for ; Mon, 20 Feb 2023 13:22:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 36A826B0078; Mon, 20 Feb 2023 08:22:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 31C166B007B; Mon, 20 Feb 2023 08:22:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BB8F6B007D; Mon, 20 Feb 2023 08:22:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 09D186B0078 for ; Mon, 20 Feb 2023 08:22:45 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A3A2FC0327 for ; Mon, 20 Feb 2023 13:22:44 +0000 (UTC) X-FDA: 80487735048.21.9C2674B Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by imf13.hostedemail.com (Postfix) with ESMTP id C010C2000A for ; Mon, 20 Feb 2023 13:22:42 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Glm0gzqa; spf=pass (imf13.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.42 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=1676899362; 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=gHVykDnTVfEe2ltKGMI8bVmCtEd1vNV39cKBYU9Qx6I=; b=Ze7687vAasrfdrnNytoETvUB8p8f6B18iIt1KGjbhz1li5HsYFXaIWWmjaK3y2qYbsKObP sY2G32aS7J67fXu9lUybvgV0LklgjLMk867P7vVmRgSq5MrpPyO5KDYLwqzxzjymvwFHdj qrPXiBzIlt92pAUeI0GS630UCT0OXjY= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Glm0gzqa; spf=pass (imf13.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.42 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=1676899362; a=rsa-sha256; cv=none; b=gACHmg6tImMSgTVFTl5oVRZfgqGIP4kF6rotfj/FbawvYmwRVh/IBM8cviaMWWqblhSV58 5rUDQSRKyT/Aknm/z/nzFno+hz3y3lAs7Xc31pDR7R5S5pWwtcOqOg8B/RHcFyoNaIqFCT nuEoyWd4PuNoXB7JJ1n2wqD58T0Efj0= Received: by mail-pj1-f42.google.com with SMTP id v3-20020a17090a6b0300b002341a2656e5so1256934pjj.1 for ; Mon, 20 Feb 2023 05:22:42 -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=gHVykDnTVfEe2ltKGMI8bVmCtEd1vNV39cKBYU9Qx6I=; b=Glm0gzqaEn24tR7vRh2d03QbFcPso1B81L7JYDblYbyNFuMFv2rxyv+ZMoprvv/nlL nQcNu1FJsOiE+iIcQGdFkuBmWA+RnK3pCFeCGghriEgGEIMbQCwza1oSwuWbB6LlIB7+ 2zVKWFV040ExfU54b9S/58TNxbZ53rw7zH5RYikzuIzBCS+J9QgnzK4nHUT3Tp0Tom5/ T3UwJAdSTsOqTTNGwXey+CihsIKksZtGjKkvck4J0D9/nIKRXLE0zNk30JQrYaN42EVT R76x1JF1Pb+0LiGSlqrGGw7o9A65is53CWRsXveXkPE61bvNRioWvhuTGxIeg4MEjsXB VgWg== 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=gHVykDnTVfEe2ltKGMI8bVmCtEd1vNV39cKBYU9Qx6I=; b=jqs/fL9bxLlEK5EYKn2cCyt8MP1rLehHIs2nV8MKyZIs1md30liHe09O0E8oM3a0dN kAMr+Ig/2/laLA38+yuMKXBpDkBkAq4VSqo7bqCmYwxB/aqGGQ720Uvxml4D6MzimVSl fKOx1Q9Gn7ekFD1UjYU0tSSM6if/rNTzl9ZYiym/rQdwq9FoKU9RYjaRl72YElAriyKA 7RDTIoKkqGGUzAVHRAWU9cFsDbsePhT3ZI25p4a/EZl4kBYRebBsjdE6VS2zO4VUMc9B 223yM7eaHywathYipn4wKAlEaPgGBtL7egCTSAGBk4CbZ4isTlLOu5+899dBh3oOnKlH HTLw== X-Gm-Message-State: AO0yUKUNfWHSgM4CRlT9zI+Tkk/6oudG/TnCKqz9PjwikLdJfWEozt3F 6D7HsRihvFgn/IS42VPR7pU= X-Google-Smtp-Source: AK7set+pjIt4s6OGQKGkcSK8PSwsYil3ELAbpE6plGBQn0/WKJzyVHDWLiYk2L+SJxnVX3ub0mcleA== X-Received: by 2002:a17:903:1c8:b0:19a:ebdf:1994 with SMTP id e8-20020a17090301c800b0019aebdf1994mr4632276plh.52.1676899361726; Mon, 20 Feb 2023 05:22:41 -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.22.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:22:40 -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 03/25] mm/zsmalloc: replace first_page to first_zsdesc in struct zspage Date: Mon, 20 Feb 2023 13:21:56 +0000 Message-Id: <20230220132218.546369-4-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C010C2000A X-Stat-Signature: aoge7baoiqrginfg47wkxyt5emqe5jwy X-HE-Tag: 1676899362-177307 X-HE-Meta: U2FsdGVkX18w4qHRkBxjfO0XM2E3L/iD1W/mb16szCWKTT6oGKFzLXfnCmDEUm5tKurbfn7mee8WF7uuMvsAOPtvWZJq5Wp8pPbBNl1LgiZeQ6Pkm25ZrlqDhe1h8VrE3leFKlAPiHksVF6556cynhHDxFsdiPK30yi9SUZFxwPBK5a16ncw6hGDlwT8kJShmyuVQ32HatX6OOADXyPOL3yQFHo3xxk/Bi6yLUMd57WQge3Upq5w7YlsDX2hLsIF5dZ7oePOnTiPHUb9g5AA7IL9+WL3VlK88qUMTWH1fmXtMM/uO0Iqq6mRXgydNwHDWwQ+z7mdfaTurgIJUycOGUOIN8eIsn3mQ/7eMBeYB4edzuZPVySogMO0QMZqxW1xYFqCLJLqY5158KOSZqOvhB0zUFuTmdfNqRGXk62UBEeJTmc23gSlPHsDKHcbfFLh4KBuCty9CXshigNsvJZocYjmG9KnW69t5KDfkXE2JywmkMDQHu2bTGOLzQXN6k56IbAQG2FLW5UYuPESx+zcHegRgrvAESYfIdUolCsQctjlbf+H88IP0DYbTP1zuGtSDJGwsJm0kCfI6/dqeBYSYcz2rlOVoS7lz97ULqMUF6LPrvg9ryQHhJybcZFUVI4086ftfpdnHQQsasoLmNUmOyOh/1V8wFFIC3wUtYzzGRubpjmGLAR/HgwQ+simfT64UlNajBBStOgfUdgCL2dTEczGiY4jrp90GBVKaVOaq2fR9p7bjaHPbc6dFMvtO+k6U3H+UNcAxFICB+B/NnwVEzk6lV9DlMUhLWhO/AF4td5iKxk4DVLFtqD6T39xXhr6YAYAnQv0Xy1Z87HtBH6VYn118BrZOXJppVxpxfrfygDD9FF8f3GIMIXiRu6iiSuGLLF7++/4gYJEvXWaeD6EQ2Bpsi5ICuLqmAYfBDKifQSzcY+kXJDYno1oLQ1w6mWO9+Q8eL0j4QnjMFmuGoA c+nxY03f PRGHzPqFZvmCb6kZZDeU89xWKU+B60EJi+eXe5y5ux+e0D7FFXlNSn9UQ6zIoAELegiAnpQrI8GUQeaGYMMmVDmSCi2XX5TxcM7shyt/F0WR/HIlWMevsxY3y7tgVaS3RS6hkef2E2Hu7z03MpNOcluK+cbCqa1Gpd7pWj5pyUxJD5ol/GxXi2LJMvg9TyXIXOnp0vINbwMfVQ7ODW2oSY0y9Rvee5b3029nRxcwVUS9mskf/bCZR1SqPWsA6g3av83y92fiTdAjCj/QcPM4Qfi2wmgq8HX4XR0gzvB+rhzbPyOvCXOLppVFz8T1r+Y13kA0MQ0njX6t4lv72qD+IQEHbicuSF7YPQDhFuB5E0PxKOHIFnhuyv0qhyHRcCe/raW41OXUHsHurFUeSQ4n+/XMmS1CNzwcUTkyTJu84kfNNxW+0HEmCnFTvJOWv3EQDp0ZLCL3bjAhgzi72Yi3B0RqVLkXMQ7CpcrFccllJ8jV1blRjj68V5L+GUNtAJ4pIZx863hjh6iTirdZYBHGhuWl7Zy+a38Dztq1Tshd6LoctrhymeSWihIcvNhhAjkBf51lC/KVwvOXMvRYhtgMPwB4aJ2fhTplWMdsy 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: Replace first_page to first_zsdesc in struct zspage for further conversion. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 4af9f87cafb7..f7b6b67e7b01 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -266,7 +266,7 @@ struct zspage { }; unsigned int inuse; unsigned int freeobj; - struct page *first_page; + struct zsdesc *first_zsdesc; struct list_head list; /* fullness list */ #ifdef CONFIG_ZPOOL @@ -667,7 +667,7 @@ static inline void mod_zspage_inuse(struct zspage *zspage, int val) static inline struct page *get_first_page(struct zspage *zspage) { - struct page *first_page = zspage->first_page; + struct page *first_page = zsdesc_page(zspage->first_zsdesc); VM_BUG_ON_PAGE(!is_first_page(first_page), first_page); return first_page; @@ -1249,7 +1249,7 @@ static void create_page_chain(struct size_class *class, struct zspage *zspage, set_page_private(page, (unsigned long)zspage); page->index = 0; if (i == 0) { - zspage->first_page = page; + zspage->first_zsdesc = page_zsdesc(page); SetPagePrivate(page); if (unlikely(class->objs_per_zspage == 1 && class->pages_per_zspage == 1)) @@ -1643,7 +1643,7 @@ static unsigned long obj_malloc(struct zs_pool *pool, link->handle = handle; else /* record handle to page->index */ - zspage->first_page->index = handle; + zspage->first_zsdesc->handle = handle; kunmap_atomic(vaddr); mod_zspage_inuse(zspage, 1); From patchwork Mon Feb 20 13:21:57 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: 13146432 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 1E44AC05027 for ; Mon, 20 Feb 2023 13:22:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C2616B007B; Mon, 20 Feb 2023 08:22:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 871706B007D; Mon, 20 Feb 2023 08:22:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 73B0E6B007E; Mon, 20 Feb 2023 08:22:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5DEFE6B007B for ; Mon, 20 Feb 2023 08:22:47 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 158771C580A for ; Mon, 20 Feb 2023 13:22:47 +0000 (UTC) X-FDA: 80487735174.24.5961DCA Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf05.hostedemail.com (Postfix) with ESMTP id 2D603100013 for ; Mon, 20 Feb 2023 13:22:45 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=m4sHT58j; spf=pass (imf05.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.44 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=1676899365; 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=su9AUGykhersjsst4vs9klhjt/8CsSP7xnYPDmfSl5c=; b=SYwhuR2B1Sqzur69wHsouXF4PqUxzveBsFKb6Xkhtdk0rgYazbwn6YIopSLHawThlZmBuC F8T+60GP6QisanHqDotp99w+JiOrHd94szPwdaDEwgnLF3GhiMTZrz5n9N8wao9/yGDmoB mE7l5tezva2FIgomS+kr83tdphUhL6k= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=m4sHT58j; spf=pass (imf05.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.44 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=1676899365; a=rsa-sha256; cv=none; b=yzLHOT7HxUKrkF7Ust+LlHqZZoWVxomhXMk3k56eVW6lEy5rU7mRzpUAGDZRqUw1vsv/O+ AgSWwiRm34W2Bcj2YLfTovGG9wAH70lLOmngdc4a+RxDeN78pcDCwnzKrTfE6MWPJxktjj /ghAmYaLwZeECszhvbfOguMIVWQ6u/0= Received: by mail-pj1-f44.google.com with SMTP id il18-20020a17090b165200b0023127b2d602so1442352pjb.2 for ; Mon, 20 Feb 2023 05:22:45 -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=su9AUGykhersjsst4vs9klhjt/8CsSP7xnYPDmfSl5c=; b=m4sHT58jIbhWJ3czvzfGCWiobij/g12pgUp0L9wpWvw/6qPQYP53ZQY2sFTWX2cB0J e6oF33FtFps4j5tJIn9xs/UrxS/RCG+vXjThyqMGZKgCYLOSqYhzdpqjNdgO2a5YfpLh qGA+U9K94VcFByTssTsTcunOYV1zHyMvV2Blyl9lMPJqlR3oniDWl2nC6YO8Ovb03spc rxArW3B4DhtAPAbF47d/NSr32KgEsFwMBUEy5AHpQ0pGesmEkZAqdaZhiGnNBbPGZNpO xJ7x7IySYoBmkQnICgFLwy5YPaDJfFkOvDZWhE7zyoc0MPEiD2jebHXNKcVwSMgSjHcN BNjg== 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=su9AUGykhersjsst4vs9klhjt/8CsSP7xnYPDmfSl5c=; b=XVDCu17zWw5VwgEUH9jZgzWX0ApQuFUajniH7qTUDRieSbZs13Tf0wZZcMcX0cn2+x Q9xVwBe5x2JVFAaTSDKLogZdr4YHxzEACe0xj+5V3WOfFPG3A1tpN3TwTfIdIIovD1xh QfT0aYJtzs8yLfowWvu4ZPWy2cvhQEpbZLyCPmYMz2hhjWe6Sn255OWJZDh409pgBZAL qHGrNRhTu1DavrVskjsWCyxNUA07BZzbIVUumKB2a20RJl7a89vRj09YYSIv0uLExUec quujqI6U8OE0rMKTUSB4BZOAkvN+99NnZL+0uFAnB93n38VqAjRR98iSTzGn/8SrbhRM 6hAQ== X-Gm-Message-State: AO0yUKUAsTPGj7zAZ+PE+oYVYaGsDQNbUuoo3c1LN24RvLJWb1kQ3zoR RAA6ks5PgMlGDIBKWULAyadoEDhnpk3axg== X-Google-Smtp-Source: AK7set/T1mg4U7o08moigSuVSJRAus8woDkV8CIDUm/5jwO3jQxCdTocbBTL70Gb+HBT+mFLqLesXg== X-Received: by 2002:a17:903:28c3:b0:199:219b:f81d with SMTP id kv3-20020a17090328c300b00199219bf81dmr1871000plb.47.1676899364633; Mon, 20 Feb 2023 05:22:44 -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.22.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:22:43 -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 04/25] mm/zsmalloc: add alternatives of frequently used helper functions Date: Mon, 20 Feb 2023 13:21:57 +0000 Message-Id: <20230220132218.546369-5-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-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 2D603100013 X-Stat-Signature: ju7apeaq94bxkwhgwb386eh3uxyekuks X-Rspam-User: X-HE-Tag: 1676899365-112830 X-HE-Meta: U2FsdGVkX1/ssaXtHqTvxAUpZmWDQsxSrZme3Wa7KESJ0BKIpS7OUQJYf6X1HcSKXIZfFl78Yxa3wPkRZipg/2TraFbTXdjk+TJ0CitEBWUUp3/aEuWr1waCjriCeqvuEAXGk8Zo0xKFZ9MiKShudsEPUwOTX65tcoR3RGHZAZ4HHvj9JwSKEc/dHulsZD3ImdyLAurzBGssXcrODg/6eEHB4/3sN77WYqcHEcpoJ38yauwVpzd9IXZI34QW2k1Ze7o3c0LlWRgb5YVl18fDiCsZiDFChJfL0xf2RBVZ8QxKblTfpREWlkUPFRScUfDQEUnA+b4ISbWPATtfMJvqTwroDS2dSOHZOF7KB0Pot4vcoVeldQjgsru2xNDwyilFdSznCmndjzIIqdAnBcLCkUMp+qrCMlfazTaT0RtVwaycuQwW65Fw0iyMhRx1c24TxUm6w4vlUOUOl4vGBcM6tCR58a/IKDma4UEOYQBPKc+xN3NcwubMlwj0s7sg0vcDSFWEdTsidQ+f5ogUohh+LV6qVrU1ZaniiMcF8EuTEpw6LL5Z1Lk+bxci1Hhhn0gSYLKIdCPJ8BdPN3eBFCEMrfU7eAx8yiurXep7lk0asFSg0r9OFRoYHxi5hXom+m+NWyQ/fkJ0h546bVYVE13e04wpm1W6QB9/rJnA/6ogMXEmasTsplhf3YaEXBdTqtxHptC1eA5J1qgpYOqVrzz9rYIFSYb4ynSqi4YFxGoP5kN738eUCYc3g3OvWuSqtP92KTVkf/pzWbS07En7c6yDrgk85I+0HrQVFHgDm+54Z9BpRg2staJ1coOx2+ciNKuvCzCQ1xnpgEdjkoqSMUK4bZGT4bs57FnKWuDhm74BH/cwzVIo1iFuWKEzqckcwE4C3x+V6MAqrK/00jHWnKqsP57E8MK4BrQp6CvINAv6KRSMTA6Sel+tWovbBsz2X82D9NlH2WiJzrLPdVHgppy vQQ5zJ9e ih0KQF+cxpLxB/xlzci3LGLGBLzJ0oUHFzHt/VGP9B0tdZh5E17KFmiJvf1XB/FPiwwZ6gv+sExV6O7OrsS088Nq1ZIcpwH7iGZ4ofKQoLVdEQyHB1mQ+qjsUGMLnyQP44T3jwW/7ll+Rc2maFHZ78T3Pp5DW3C2HNvdKm34SPWMSTHOwVwXeTbwIgiPdSF/YIGqT/Q3zgMVYDMjsNXXJQD287ANaWoQD/xLYbf/oeShab+GEPXhftnGkwgKTFePq3BZ52uVFtX2NJUMKOWV00Dh9qhoPFvSxExFeKwl30BKpKfa4rK1WQJwGf9eQ3BpTtUy/cidpUSg2b3OP9+GJiR6mWIRpHOGKGCRvBen7q7gDmC1kHYs9oeYhgYaGNdarAsu2gP+ijTiM3O2WdgWPE+g0ZZpJbRH8TxUFjFH1Bz7pqUt/1u+ng8KHZE09819HcZ188dg9PIicDXdcinF5nxmxwPdY2CoIaQQTTD4DG07h/9sd+Bq/OeVO/vHoOYnWeasODkxoE7172MBrjMhMXFmJVQmogNveMy2WSz37yDFfzGrWefIcAuxMRQ== 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: get_first_page(), get_next_page(), is_first_page() are frequently used throughout zsmalloc code. As replacing them all at once would be hard to review, add alternative helpers and gradually replace its users to use new functions. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index f7b6b67e7b01..1ee9cfae282b 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -653,6 +653,11 @@ static __maybe_unused int is_first_page(struct page *page) return PagePrivate(page); } +static __maybe_unused int is_first_zsdesc(struct zsdesc *zsdesc) +{ + return PagePrivate(zsdesc_page(zsdesc)); +} + /* Protected by pool->lock */ static inline int get_zspage_inuse(struct zspage *zspage) { @@ -665,7 +670,7 @@ static inline void mod_zspage_inuse(struct zspage *zspage, int val) zspage->inuse += val; } -static inline struct page *get_first_page(struct zspage *zspage) +static __maybe_unused inline struct page *get_first_page(struct zspage *zspage) { struct page *first_page = zsdesc_page(zspage->first_zsdesc); @@ -673,6 +678,14 @@ static inline struct page *get_first_page(struct zspage *zspage) return first_page; } +static __maybe_unused struct zsdesc *get_first_zsdesc(struct zspage *zspage) +{ + struct zsdesc *first_zsdesc = zspage->first_zsdesc; + + VM_BUG_ON_PAGE(!is_first_zsdesc(first_zsdesc), zsdesc_page(first_zsdesc)); + return first_zsdesc; +} + static inline unsigned int get_first_obj_offset(struct page *page) { return page->page_type; @@ -973,7 +986,7 @@ static struct zspage *get_zspage(struct page *page) return zspage; } -static struct page *get_next_page(struct page *page) +static __maybe_unused struct page *get_next_page(struct page *page) { struct zspage *zspage = get_zspage(page); @@ -983,6 +996,16 @@ static struct page *get_next_page(struct page *page) return (struct page *)page->index; } +static __maybe_unused struct zsdesc *get_next_zsdesc(struct zsdesc *zsdesc) +{ + struct zspage *zspage = get_zspage(zsdesc_page(zsdesc)); + + if (unlikely(ZsHugePage(zspage))) + return NULL; + + return zsdesc->next; +} + /** * obj_to_location - get (, ) from encoded object value * @obj: the encoded object value From patchwork Mon Feb 20 13:21:58 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: 13146433 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 0CC9FC05027 for ; Mon, 20 Feb 2023 13:22:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A96566B007D; Mon, 20 Feb 2023 08:22:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A46B76B007E; Mon, 20 Feb 2023 08:22:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 90DD56B0080; Mon, 20 Feb 2023 08:22:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 79D006B007D for ; Mon, 20 Feb 2023 08:22:50 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 3A5AD1A032D for ; Mon, 20 Feb 2023 13:22:50 +0000 (UTC) X-FDA: 80487735300.19.5E984FC Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf30.hostedemail.com (Postfix) with ESMTP id 6694080021 for ; Mon, 20 Feb 2023 13:22:48 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="XXi/LCKA"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676899368; 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=+xSSG1cF+HzKEOU6xIlHzi5yWE+5FWq8Is/agZPYpIY=; b=E0PtyZDiszB2ZWrYeFKgkuuvpJ0jGzkABRyrYp7G1BJaZZ9ClSocP320uRElNSsrTVP50H 0X9er/lnLmmUTL70nAtZFunuEkaXNbZdYSD8mhQvq0EzM8GamfnQoMZaXHYdfiFGhmBgQc suUCE1s7ew4y7MCaqN6Dn1uFftWq4JM= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="XXi/LCKA"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676899368; a=rsa-sha256; cv=none; b=nXbJGbckifUU15Vf2AANT4/LaINbBKEzLgRKQHQwnoJ607CBqd8ZjzxCSYPK5etNvL0oHG 4+txsNitbfMD+1ibGLjzylsCG6Z5+YoXMoyFemSfIRCSng4fXjIUhTwIY4Zu0uRZY9Fdl8 WY9QLKPRR20k9YsU00CT8uoqOenQVOI= Received: by mail-pj1-f44.google.com with SMTP id nw10-20020a17090b254a00b00233d7314c1cso1503960pjb.5 for ; Mon, 20 Feb 2023 05:22:48 -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=+xSSG1cF+HzKEOU6xIlHzi5yWE+5FWq8Is/agZPYpIY=; b=XXi/LCKAo2mFdy0UvJMaKl0dX6pABmdPv+T5Q04/L2J4Z0mnyfCfZYKrWUl2jzEHRL Vp0oZdsPH4k6vYoSt3snfQaVGubVwdHLUk46YcORt0vcDraCo6618MR/eUV4dirTLLfZ fN4Ym/DaEhd6zOPGRywO0dd6KqfriiyxFQKu/5j4sYqUqz1RYsg1TZuQszKdGqxtR3lz o8Wgi5vIG91QixPMCewNjV1WuS4lbJ1VaEpMENupcdBn1AReE1X9u1EIXW0EIyKB/PNM gwu/MikGGt6cFAJykt+NKEluqG7lzyGvnffK0GHDlDrbf6zF7D4A002XRxvWSP/MKFbQ Q6BQ== 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=+xSSG1cF+HzKEOU6xIlHzi5yWE+5FWq8Is/agZPYpIY=; b=WVmbYZGOEpKWwdYQPFWCgo/iTY8ve3ubxzUZ2Sa9O10lKtOSPbFkO3n0l4a8Si5mzT E2PrSxE+5Io9cMZcs+x+mcF60CftXskFmdxWeG9L7Y7DU1o+gJb7s3HYnOb9Wjm3oi5y Zu0l5h2+ojVxoiJWhgvvcWKRl2krNN8PqhjoUoBzcNQ3IgSz0tF07ISFuuEER/1T/KCL 4Gope+kDgfzd7cYqTODrDNMH3U3JCc9XCi7LqDBbRS0u9nuf7Yw4lfyCe+PBfKh4mQ57 tMm0/BTo0O7xOfZ2C4sTY7d9jBI5poNVA3eIPGuy2xsI3s0uUEQC4G5QmrGe4B7o8gbV 59Jg== X-Gm-Message-State: AO0yUKVtcY8a2Uey0UCr6EfJq1DKmSYKT3OOb/d+HmfHn9cDg2Rpm8c/ opoynfe2/ekhc2BGszsYv6Q= X-Google-Smtp-Source: AK7set+4/MHxZuGpQOEjDZC2tljelJHKpPjn9FokUXyXvUusUJ10ZCD3dsuq0mleZJBQW/TK7ircuQ== X-Received: by 2002:a17:902:f685:b0:19c:169e:ec56 with SMTP id l5-20020a170902f68500b0019c169eec56mr1283278plg.37.1676899367380; Mon, 20 Feb 2023 05:22:47 -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.22.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:22:46 -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 05/25] mm/zsmalloc: convert {try,}lock_zspage() to use zsdesc Date: Mon, 20 Feb 2023 13:21:58 +0000 Message-Id: <20230220132218.546369-6-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-Rspamd-Queue-Id: 6694080021 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: a38i1oniyk9wdiuta15fskeyqp9sbbi4 X-HE-Tag: 1676899368-607427 X-HE-Meta: U2FsdGVkX193NKpybDW68H+rhPIs7R+qybmke5j+zDd68qm0KLGZ7UZP/P/RglxjKhKwIZrQq4nTMCofUvqyIpzMttKW9NXGuzfsTguP2SRDAaTIllMdVji6chl8JPLAkyQ7MJdJSxQVFAEr/boXCjV1741nmFLoMfWGMqlPMcvY0GY6WjyDWLAz3Lqkx9gkVXU9IxUWa2BzylWv0eS7QHCeFOb1fOAlnAGsjANB+mKgtQxOHSw012/GVH8OJsROJEoPhTP1AGXlFfP42UTKlxmUHa6WAaFexl7pfOEhotOnMVXu81jkwao5A55yxwdlyPYfRLIulqzRu/mWeuXwovSBC+bKgz2X8bwCbZyME8xismDVOR739uq7otMGEj6ey/7PhhPCYzuVH8bxlmVJQrXJ1GsvHbDfx2Uxp0QngR1wYQvEHu+S7CIoZ09eNHiqCcnHfPyTOWbZHtB7R6FTMx4kNetqUPpJmdsVt/41K9FtZNY3fggBzqMmu0t3FaMpH15zKzIql3kWBLUK2Rb7KFb5wR7qQiS68FWCYXH/ctKhPPiMqJuaODrOfu4zSJ8j3bddc0Mkwrz/4U58FM7TakhsIfGO0nrVgKldwuPtKBBptvg0l8BvRU/irMLlJGfqtZhJe6cKeG6/MG9/RLNdTL4OlwoAr62ky4ImV44y2Wm5sNZMMbii93VGAcVwCMlopNnjUtrnMo+pka3s5emFbSfkHD1DwzXv5MNHAr0ISWVJ0FQjZ8cfAx+L+fnNA6No0itEeRUEaqcJKbYpT441QMtF5acF6qcTgP08XyUeYjqbgNhy2vE7Mpwsp2vabAspttEbxkSpG1nJn2Ido1pB7mozAGCPolGddRf4kMzpj8CCJ0i4bHsNkFfP2QDgNPFyqrlB5SM5lMApbpM9DUfeVRXizdqLQeoNl63s7cbxiSQSVqIsq6BVd78SkVooNw1qL7PRfHS0I2xSTBtpy2M 3LBAtbxj jYxDeFY97EK3xmUkTYQ5zc9Xibew4M38RknZ4A5F5CT4qhRwvIoN8BOZ64NM+7ajO0scxJZOAfzq+Whp5gNGKV/mOIDtYyu/1NDNlTL8JW7eAFztZGTHiPRgOiyZRGc5Nfxgvvz7FeOMx6xYWmfDlCfQK1jJu6ZMtE6FlGkfAvH7JJwcSRoDz2LuA7hiGCnaRfacvSgtV/wErX/yUxNLujXJi3GjMDbu/kp91jSNO0EMUsuX+lAk593v236xGNOfqDWs6ajZW3iT4KsezZ7AeP1JVa581jscyGkylPouNqJa52jEAWSBgzooh6h0PCuM62GSuY7bZfdhegACidMvXDoA/Kax4lIOFwpd6hAqRYmY6S/WFZFLDXRLn+NiPfY2Cz1lKJd4ym3Y+Jb5mhlZ5En23Zqed7Gx+dV9eHxzgfZSYIP0KdzuB0kTvu+0PH78vX21JCrm+uc6CelndPGewb4akxeIqXsfsevo2ehVCyIQHYcc8gj2BK/W3cEC6IJ8BwbF5uoXlm/BV5W+OJ21+6RAa5dMuCzTpjAD0gdHmTmO91Y5Ie7IqL0B3ZhXdqUqeIELoA5ecazK3Ok3VfwF9D1C6sFqJ18FYb0UH 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: Convert trylock_zspage() and lock_zspage() to use zsdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 1ee9cfae282b..dc6a7130cdfd 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1091,11 +1091,11 @@ static void reset_page(struct page *page) static int trylock_zspage(struct zspage *zspage) { - struct page *cursor, *fail; + struct zsdesc *cursor, *fail; - for (cursor = get_first_page(zspage); cursor != NULL; cursor = - get_next_page(cursor)) { - if (!trylock_page(cursor)) { + for (cursor = get_first_zsdesc(zspage); cursor != NULL; cursor = + get_next_zsdesc(cursor)) { + if (!trylock_zsdesc(cursor)) { fail = cursor; goto unlock; } @@ -1103,9 +1103,9 @@ static int trylock_zspage(struct zspage *zspage) return 1; unlock: - for (cursor = get_first_page(zspage); cursor != fail; cursor = - get_next_page(cursor)) - unlock_page(cursor); + for (cursor = get_first_zsdesc(zspage); cursor != fail; cursor = + get_next_zsdesc(cursor)) + unlock_zsdesc(cursor); return 0; } @@ -2056,7 +2056,7 @@ static enum fullness_group putback_zspage(struct size_class *class, */ static void lock_zspage(struct zspage *zspage) { - struct page *curr_page, *page; + struct zsdesc *curr_zsdesc, *zsdesc; /* * Pages we haven't locked yet can be migrated off the list while we're @@ -2068,24 +2068,24 @@ static void lock_zspage(struct zspage *zspage) */ while (1) { migrate_read_lock(zspage); - page = get_first_page(zspage); - if (trylock_page(page)) + zsdesc = get_first_zsdesc(zspage); + if (trylock_zsdesc(zsdesc)) break; - get_page(page); + zsdesc_get(zsdesc); migrate_read_unlock(zspage); - wait_on_page_locked(page); - put_page(page); + wait_on_zsdesc_locked(zsdesc); + zsdesc_put(zsdesc); } - curr_page = page; - while ((page = get_next_page(curr_page))) { - if (trylock_page(page)) { - curr_page = page; + curr_zsdesc = zsdesc; + while ((zsdesc = get_next_zsdesc(curr_zsdesc))) { + if (trylock_zsdesc(zsdesc)) { + curr_zsdesc = zsdesc; } else { - get_page(page); + zsdesc_get(zsdesc); migrate_read_unlock(zspage); - wait_on_page_locked(page); - put_page(page); + wait_on_zsdesc_locked(zsdesc); + zsdesc_put(zsdesc); migrate_read_lock(zspage); } } From patchwork Mon Feb 20 13:21:59 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: 13146434 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 DEF3DC636CC for ; Mon, 20 Feb 2023 13:22:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D73E6B007E; Mon, 20 Feb 2023 08:22:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 787A66B0080; Mon, 20 Feb 2023 08:22:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64F186B0081; Mon, 20 Feb 2023 08:22:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 568776B007E for ; Mon, 20 Feb 2023 08:22:53 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 24B4E120435 for ; Mon, 20 Feb 2023 13:22:53 +0000 (UTC) X-FDA: 80487735426.17.E3917FA Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf26.hostedemail.com (Postfix) with ESMTP id 31091140011 for ; Mon, 20 Feb 2023 13:22:51 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CY+FN2dA; spf=pass (imf26.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.181 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=1676899371; 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=juu7JZAgQxY5cld5OKVOucJJE9jEtb+tt2neD2yXqiI=; b=rtYoiE5gQVgW7M/aPJWw5xVcfsCguk40MMyjz1vPbV8tZVoDVSufc0Rkzk1pCQSuaS4Ipq RIO44QFZ6tgluRiGEQtCqF44NhBtoCe1mccsAWY9VU0TWcNm2yt9sW+W8TL940t/hq4Ac9 uXg1Uo9n1BB12ms9OS97Xy3QNltKUi4= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CY+FN2dA; spf=pass (imf26.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.181 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=1676899371; a=rsa-sha256; cv=none; b=QoWRndo3izyACSib6saA8qb+SvPAekLaF5zs42zvZICcVXaL6skYDk+68z84WgtBsBbclM 5bY769KOfxEdLiOkxWrtjFbHvwpVoTIXOJTBIlvTMmemFLUO2R9imjRaYD5xteJtTqp0im WZ6HG1sK+C5pEgOA3Ii/k5pDTJNwsKA= Received: by mail-pl1-f181.google.com with SMTP id q11so1664467plx.5 for ; Mon, 20 Feb 2023 05:22:50 -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=juu7JZAgQxY5cld5OKVOucJJE9jEtb+tt2neD2yXqiI=; b=CY+FN2dAwa7IZKgOsgVrCdROAFo+gk+8zZCRn0yuDmBVghOqzCN4XtsD/Y/5p3lcei o4fUItQgE30yzw5oQP4aZEi7WLABsSORrr3WgmBhZO6FikowNbOVnG3pfgO7fMidtFa5 Q1bXXfRi/cNMr8hc0/2x8GbsNy990SsqFB6PXDD2xYJQeQ9OKqvUXmoWADtpLoXS7+Eo MXlNKQcEEyTmVXlKdnBUGoVT0vUR1ZP/BrTTgpVvLiukrDii+M2V5OnYiHMqpeB+zt99 lx26RmzoFnA36CgH6DXwvMrJ3n/hJy9g0m+mlOWz8LyfMcPnsmQBhEpqj/YZdgw3pGEp EEbw== 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=juu7JZAgQxY5cld5OKVOucJJE9jEtb+tt2neD2yXqiI=; b=tLJE9ogR3xJqYJ1oSCz8zLjmB8YZvv1nnLFMCnpCEoJIcM6k8K90qaIDh25OQO1eki nN6MNnkBpFeRTHubUtxp+F/Fs0sBIeje3fUOm0AorHc0UHHFa1Hh1XWPbR1PZURO+iHc x6WGow8H7eA1l7ahvqgXuvdUC902DppqaojmHTysShRI00QNBM41hyzuKV2GdXJUXHsi 6eCebt3KQQqyi3cgcy1RCa6PfdH2AaUQQjBLXNluPbzTb/yNXgToARzwJ08rfly3XTNp SsqGAOIhjXf2MLMrInzaEBE6qupsScSpHF6BenCfHqXXGeVFLZU2pJC4htfrqtl5GKHt dveA== X-Gm-Message-State: AO0yUKXq/OfN1zbH/5l4nxQnbvRqrsbZsATu9xvcqCYH9BWGBqq34gpS YhGHAcl2cG10zCISKsIZ7ys= X-Google-Smtp-Source: AK7set80FS3PeBhRDD9FEXKZEavXU+lFgI6EfW9xS/PTGxNSGOt8pBy/ybrWdxGsgNM0RC+usoZX+w== X-Received: by 2002:a17:902:9887:b0:19a:b683:e11b with SMTP id s7-20020a170902988700b0019ab683e11bmr163455plp.23.1676899370096; Mon, 20 Feb 2023 05:22:50 -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.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:22:49 -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 06/25] mm/zsmalloc: convert __zs_{map,unmap}_object() to use zsdesc Date: Mon, 20 Feb 2023 13:21:59 +0000 Message-Id: <20230220132218.546369-7-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-Rspamd-Queue-Id: 31091140011 X-Stat-Signature: t68qgp6fmqhyh69rueoz4sado3ouybau X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1676899371-952377 X-HE-Meta: U2FsdGVkX1+qPwUqWpuBtu6vFeHTrn44tjBxHAVWhADxKpYFhsPtZULlD7vUxFyChjRN7lrU2RWR4tamBtmwtX1FYSpGn1W2dcm0/jq9KDJUzMrIWQDEIOJQDXANuzAuERxOlBs4MGwOO2MvX3tJYBrCRsOTYebgwOaY48rTiz2IvTPhyfl6/c47lNUSyTNur6+0C5y7NJbY3M9o5BrYhaVZbbzQJrapxsFSc8kJttho2CCx/u6G0RVEgRIQiyVuwIkcZFKmcvAKG7Xr6ro6sfpyO5pNuHifAJRmI6xBkrPddec6UInQbRTDm6Px/ystYP7PfPMSeQXBSy7J5wIoxGGDAkCbK83qiM4QcNQzMAYNI+S+XjNQ6GWeW1wEr73jOn/KTikKC5FszxmKjaIQNsJlnmjpaKDc66VQGUBDgfNgaJYJc3lKFO80ShARaaApCSQFLarYUpj/mJL/wcQvzZHJvsBexZtc3iT5+55bb1XoUJ6vZqJaU6SsUhc5jE3a1VvSfhtASUUmG1On5M2jFC8sBauLvZdJeQKxvTVZDU/ZpECDp0+RembPwOQe0XdV0HbSnjEt1CRvk7K2gn2rmFRU0hKLB65xNYQXy78V3ZGluqQqy6bFmatTKvAo2kAcGmmziQd0NXLtm2ScA6cSoyX1sptHCaEGdqql8FPOecHgjplAIJw8+T/c/3sDtZuzs/2CFsc+KqRSERUf4etqLtc06EgwdpOOcTj57XnTrB5Cjg4qRUPp9NkhEw8+3Xo8eo/sSBloqz8lKlDEf/bJ2F0PQlNuo2N9+f2a3fakB6HdLqxP9vaaRO7Ztt40sbPM1kBIIjD+/5wf9wtrp8Wx6tapg/1oeiPAt/Pz3HbjJG/y8BrUxP+Yt5Ct1SWOsuzQ5TFzKokhPajJPmeDLfcTQLfC8K/IQHErYlU81AEP2LP18YVoosXyRBIDwIWWm7WJa9rM0p6weGdJx2OrrQd dIqQZTAO rQybEUcMfQzHVEQXEatF75toRiL5NRh2ELagM605Zy2wcM72llG0kSA7dGQF3EUNyV0OZ1tNiCbvpwBMOwjsBul7RXY32jCi6wHnEwbV3a5VSrhgcZL9EAp2Yt6EwqtSE1SZDGKipctdGHTOQe3cCKvtzz9PvWI2v9PUipqVDDqYYG3A8dDsCv1hDoC2fWT3CgHcHkOvvGy6C5U4ilmmzCyVwA6jXx/t9l2zL8rpOVdNNv+D7g2fDyo/tIM98Q90MrnYvGTMlXC7IUzSL+n06TPezBC7p84aJFk2zNac5wwWGYTGAvSRlTqXj4p5p9gl2+fPjTomv7leKhvB71jOSLkFG34V7OqK1Gqq9sJIRnsWtsvZuXPXGPmLeLpVeQukPBF4A7WuLY+VMqNQQA1n3ErFUm7efkkx6W68YS/1VSL/cXT4VcfwFR/kZfX3AMtwocNfo61epUdRMIm8NBtCHr7UHoojsBTCi9Z3llln5xGyuI1GZ+vt5+cpi9UelJH9KF2dukHlPN4IB1hbi+JPMWlvlasbs5d4RQeNUHnwfXRpGXN4kd7vFesebyjTPhruL4nhqNyLPJqRRbW0IS4A7PxMV3kGu1bMVgSoc6n56Ge3T4Nc= 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: These two functions take array of pointer to struct page. Make them take array of pointer to zsdesc instead of page. Add silly type casting when calling them which. Casting will be removed in the next patch. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index dc6a7130cdfd..821d72ab888c 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1361,7 +1361,7 @@ static inline void __zs_cpu_down(struct mapping_area *area) } static void *__zs_map_object(struct mapping_area *area, - struct page *pages[2], int off, int size) + struct zsdesc *zsdescs[2], int off, int size) { int sizes[2]; void *addr; @@ -1378,10 +1378,10 @@ static void *__zs_map_object(struct mapping_area *area, sizes[1] = size - sizes[0]; /* copy object to per-cpu buffer */ - addr = kmap_atomic(pages[0]); + addr = zsdesc_kmap_atomic(zsdescs[0]); memcpy(buf, addr + off, sizes[0]); kunmap_atomic(addr); - addr = kmap_atomic(pages[1]); + addr = zsdesc_kmap_atomic(zsdescs[1]); memcpy(buf + sizes[0], addr, sizes[1]); kunmap_atomic(addr); out: @@ -1389,7 +1389,7 @@ static void *__zs_map_object(struct mapping_area *area, } static void __zs_unmap_object(struct mapping_area *area, - struct page *pages[2], int off, int size) + struct zsdesc *zsdescs[2], int off, int size) { int sizes[2]; void *addr; @@ -1408,10 +1408,10 @@ static void __zs_unmap_object(struct mapping_area *area, sizes[1] = size - sizes[0]; /* copy per-cpu buffer to object */ - addr = kmap_atomic(pages[0]); + addr = zsdesc_kmap_atomic(zsdescs[0]); memcpy(addr + off, buf, sizes[0]); kunmap_atomic(addr); - addr = kmap_atomic(pages[1]); + addr = zsdesc_kmap_atomic(zsdescs[1]); memcpy(addr, buf + sizes[0], sizes[1]); kunmap_atomic(addr); @@ -1572,7 +1572,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, pages[1] = get_next_page(page); BUG_ON(!pages[1]); - ret = __zs_map_object(area, pages, off, class->size); + ret = __zs_map_object(area, (struct zsdesc **)pages, off, class->size); out: if (likely(!ZsHugePage(zspage))) ret += ZS_HANDLE_SIZE; @@ -1607,7 +1607,7 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) pages[1] = get_next_page(page); BUG_ON(!pages[1]); - __zs_unmap_object(area, pages, off, class->size); + __zs_unmap_object(area, (struct zsdesc **)pages, off, class->size); } local_unlock(&zs_map_area.lock); From patchwork Mon Feb 20 13:22:00 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: 13146435 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 AB3BAC05027 for ; Mon, 20 Feb 2023 13:22:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47CAF6B0073; Mon, 20 Feb 2023 08:22:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 42B826B0080; Mon, 20 Feb 2023 08:22:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2CCE36B0081; Mon, 20 Feb 2023 08:22:56 -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 1E8FE6B0073 for ; Mon, 20 Feb 2023 08:22:56 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E2CE41A03DB for ; Mon, 20 Feb 2023 13:22:55 +0000 (UTC) X-FDA: 80487735510.19.0382D44 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf09.hostedemail.com (Postfix) with ESMTP id E8E55140014 for ; Mon, 20 Feb 2023 13:22:53 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=REg86lUB; spf=pass (imf09.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.53 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=1676899374; 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=Frx0V19P2u8/fSH9cJcDc7e72AJEiktZXhc9Vf+vq7w=; b=mngLpUB8r+Ws4XEElPZ1vRHB2P7n4eNpPzYzl1Wu5zup61R5B2dZgom7Ymqe4TcAmLR/mm RSjcyFq7Df8XCFHYRyc3LhO+W19DcCbOm53FJbmailHElM3qM/BeNCT5ZOQIMNYRstu0Fq EVk8UM++p9wBUxSikEHCsFiuI+GVxG4= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=REg86lUB; spf=pass (imf09.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.53 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=1676899374; a=rsa-sha256; cv=none; b=0cRudKi3h/3WD98nZZkNuG+nrl/K64/Z7J3k20mfXuyYAxZ7yKZMSRDaXIT3RK5K2Mw/t9 CoMNye2fo3d5/MDyu2DPZG/0vs3GiyU0RHc8GxBQ3csI/iERGTPiOnv82oh4zaK63PEFow ZowAMOKRHIpgMi53hyqWRqxr6mwrmmA= Received: by mail-pj1-f53.google.com with SMTP id f9-20020a17090a9b0900b00236679bc70cso1995720pjp.4 for ; Mon, 20 Feb 2023 05:22:53 -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=Frx0V19P2u8/fSH9cJcDc7e72AJEiktZXhc9Vf+vq7w=; b=REg86lUBUEMDoIXv47x6hfoYGz7J1yKQe5FYVWd1ue/ZDnw5GFow6FzscMm+YOtMAQ H6LbSCBBF5SUkDqoxTMN09FcR0fMYkRmwiHPV711SUDrHR+2rBgqifcHciTr8n+LRJwT mNnH7EuOLiDCBXk/M2AiwZPJRkrPk1wPmVlVE4RjCFo77BrH1u7aTuu1InGxoPFxXeGF v6NqG678CbZge+ZLjcaCG6U2c7xhCfpvYdyYta8g7b1beSMkyRL4EknkhAKP12onTGs4 4f/e7YV/1mvKZUre8Iav3yjBsqIefxcsvcjSZ3EQH/w0jhDTTIjDWhvgCQ4HFhNE7/GB P4Bg== 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=Frx0V19P2u8/fSH9cJcDc7e72AJEiktZXhc9Vf+vq7w=; b=vjIpj3CiiY6Jqi3GntOK0Z6XtOiZISwBf7Z1KtqqUgvKQE1WBA/LTQRdyhsCAe1gjm JiPXk2z9v7MURdRanRQcLW+DrfNUtoTQzsf01W6v9phzMD1VYscsd+94oO6/HPyGgVVy 4pGes7jy2u1Kzck1yMFJ32vmwuLkEuXeKDMjEHkk6JsnUGWIpTaRGHc559rCI6e9v8Iy 2N50v65z39BrnwTPeGwjLIcoHMf4fJ25BQp+vGDtH2/WW+ZYYZd18V/F+FeZFa6hOyFb 0fg1Hx8Nrz3ceqPccKVdVGrfWlLSHlTJ4MjVn6BeUhGad/5aIUTi6H4P5SzDVaN6dWdq 80ug== X-Gm-Message-State: AO0yUKXoO0r0psJKVgaQjVMvG5LxMS61Vlm9Q8tIafq9rKIHUntGgAj4 bHkIgKMSIsCYiJzIbp9ILXc= X-Google-Smtp-Source: AK7set9xJRjsYrukRfXWha0pOdMfKLPpIlofZoHPP0fEFSRgYMBvg/1b1LOqw072S4nXx03c8ztgFQ== X-Received: by 2002:a17:902:ce91:b0:19a:82f0:7b0f with SMTP id f17-20020a170902ce9100b0019a82f07b0fmr3488346plg.30.1676899372762; Mon, 20 Feb 2023 05:22:52 -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.22.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:22:51 -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 07/25] mm/zsmalloc: convert obj_to_location() and its users to use zsdesc Date: Mon, 20 Feb 2023 13:22:00 +0000 Message-Id: <20230220132218.546369-8-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: 538kkfwrqbwcr8f9ujdsykqbh8rmpb8f X-Rspam-User: X-Rspamd-Queue-Id: E8E55140014 X-Rspamd-Server: rspam06 X-HE-Tag: 1676899373-23780 X-HE-Meta: U2FsdGVkX19T/O9HOE1Y5X16lNwID0x1aUb/Ja99wV87hrZqWRERqM8mSHoUToG12gXUivxD6AO2kbwcVIuTil9GxSr8CLt/9QxCiazmxxMH3l2ZJpohpH3jTM3aB1tB3NXn16ltswI/5GMVe9x0w7P0yYyJHQGItiRwnTBKMAdvM61bKPuHoF/pSXhAw6WIlEXZDR1SuB9QV3DBUhl1MNappfBwWpU+BYOIFWE2XqdEpesZVO7aprWQMJ9wb5nAoA3olNBKPpED2fGxO5YcTsVoOmSJPXuXr2PX8MuNZUGvM5F1R3/BWlZaweAhpsBt4uvZu3x9+0jowYhh4y53TvIhPLgLxtJd9hJD342Du+rAN9SSpDCapAgHxWC8qv9T9ji9ahkXd8/7fLDJP5D77DPYElAPNG98FYBWqbkC8vh59uVXwyvBjTwI+ekmQDlIfkY1+VLGzx+0Y5EhpPauXygLk2SLJS/StwgPUPD46Srh09CwG3zwGGkE6Gm8ilhCQPP8wa2ap/+vM4ftw1XkiegxZ432uBow3eJfcoawMHMty3xDhid6hTyrPfWfjUTKw7eJZwNoL1/Z7D9rAFnVlOpmfzPk11sq+G+L56GyhVmZhvVidFmaOimivIwslcy4iuApSTDRsDc5V8OEZsILW97mK6W6qjYiZ6vIbD+VJqgfcq2yXEXzVnlY2zaJZoceWUry896utLUJ3bSz3d/7jLT071YB78pvvKo1NAjN3PI+6GvCWC7K/z+cfqvHS+jHI7o99BTpKLhjKZa+tRVmenBeDpqvDYrThMkl15eXHv/NjyiEiM/XRTfb7cPEV9LCYELonaMveeixKknCym/w5BKBcYpqvR1nuCN+sxNAF8dIJoLbl10n/8fUkASBrYn1FtZzeczdsD+MGOs13BS1UW5/pasKe5PCJteygZKcBYWzIGYF1JzNo4YdoUgSYMalQ3ZGihw4cBGAQZKUgMW nO+aQtaM YTkeMdpNPsSeHR8Q/mmysyGpz5G6YUwQSeOmTSZJ9wrhORMopBTyARdFG7AKG9W6aF0dnOt/QGRETM5gl+goGKb+Ec+EVnp0x6jugvpLQMk+LKiyWQ7JvpEXFQ1T3BSL6LXujAZ4dMIVZmaZJrTA2Ko9uRWPOSYYJtT7EFkYOqRLnwhfdXIOSUKQ3U+ELB2+OmRRzvQ2WA8XyC5RrMAVve1n+YyTkkzI3NSbDkwuwklz4LYxCR1l6JsJXokHkuIzUymmPCYzJ4ZcrI5HhK5GATsL/V6IXoIBeCxEtxSNUzKFoSyuZWXo64yqYSXL6i/v9ANhY55nC+5B9MCWjuuJ3aC/CP/IPeZgGbvDwwLx4a30dRfgvIpq3NY98AZyfnFRIEXGfNRC4ITBYsGQibbj5RZZ3xVSiw3Qo5F9EC3OvPyT/B2OgFMz6TwerqOjuWEwnGnaVN6fGtgqk5bs2iRkF281PgqvNzLqdbpmvHEoyInIBhFgWvDunQDz2XcJYPVg5BsRc+ZJiRkhF6QSAwcIM9BBFdepVpTDAnsebXrQjCb9O2fKnxJeJFUnfiqGsJR7wSR6t8d+aHclf427Rx+PLoENVb9ghsyiDHdYe 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: Convert obj_to_location() to take zsdesc and also convert its users to use zsdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 80 +++++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 821d72ab888c..56cb93629c7f 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1007,16 +1007,16 @@ static __maybe_unused struct zsdesc *get_next_zsdesc(struct zsdesc *zsdesc) } /** - * obj_to_location - get (, ) from encoded object value + * obj_to_location - get (, ) from encoded object value * @obj: the encoded object value - * @page: page object resides in zspage + * @zsdesc: zsdesc object resides in zspage * @obj_idx: object index */ -static void obj_to_location(unsigned long obj, struct page **page, +static void obj_to_location(unsigned long obj, struct zsdesc **zsdesc, unsigned int *obj_idx) { obj >>= OBJ_TAG_BITS; - *page = pfn_to_page(obj >> OBJ_INDEX_BITS); + *zsdesc = pfn_zsdesc(obj >> OBJ_INDEX_BITS); *obj_idx = (obj & OBJ_INDEX_MASK); } @@ -1498,13 +1498,13 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, enum zs_mapmode mm) { struct zspage *zspage; - struct page *page; + struct zsdesc *zsdesc; unsigned long obj, off; unsigned int obj_idx; struct size_class *class; struct mapping_area *area; - struct page *pages[2]; + struct zsdesc *zsdescs[2]; void *ret; /* @@ -1517,8 +1517,8 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, /* It guarantees it can get zspage from handle safely */ spin_lock(&pool->lock); obj = handle_to_obj(handle); - obj_to_location(obj, &page, &obj_idx); - zspage = get_zspage(page); + obj_to_location(obj, &zsdesc, &obj_idx); + zspage = get_zspage(zsdesc_page(zsdesc)); #ifdef CONFIG_ZPOOL /* @@ -1561,18 +1561,18 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, area = this_cpu_ptr(&zs_map_area); area->vm_mm = mm; if (off + class->size <= PAGE_SIZE) { - /* this object is contained entirely within a page */ - area->vm_addr = kmap_atomic(page); + /* this object is contained entirely within a zsdesc */ + area->vm_addr = zsdesc_kmap_atomic(zsdesc); ret = area->vm_addr + off; goto out; } - /* this object spans two pages */ - pages[0] = page; - pages[1] = get_next_page(page); - BUG_ON(!pages[1]); + /* this object spans two zsdescs */ + zsdescs[0] = zsdesc; + zsdescs[1] = get_next_zsdesc(zsdesc); + BUG_ON(!zsdescs[1]); - ret = __zs_map_object(area, (struct zsdesc **)pages, off, class->size); + ret = __zs_map_object(area, zsdescs, off, class->size); out: if (likely(!ZsHugePage(zspage))) ret += ZS_HANDLE_SIZE; @@ -1584,7 +1584,7 @@ EXPORT_SYMBOL_GPL(zs_map_object); void zs_unmap_object(struct zs_pool *pool, unsigned long handle) { struct zspage *zspage; - struct page *page; + struct zsdesc *zsdesc; unsigned long obj, off; unsigned int obj_idx; @@ -1592,8 +1592,8 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) struct mapping_area *area; obj = handle_to_obj(handle); - obj_to_location(obj, &page, &obj_idx); - zspage = get_zspage(page); + obj_to_location(obj, &zsdesc, &obj_idx); + zspage = get_zspage(zsdesc_page(zsdesc)); class = zspage_class(pool, zspage); off = (class->size * obj_idx) & ~PAGE_MASK; @@ -1601,13 +1601,13 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) if (off + class->size <= PAGE_SIZE) kunmap_atomic(area->vm_addr); else { - struct page *pages[2]; + struct zsdesc *zsdescs[2]; - pages[0] = page; - pages[1] = get_next_page(page); - BUG_ON(!pages[1]); + zsdescs[0] = zsdesc; + zsdescs[1] = get_next_zsdesc(zsdesc); + BUG_ON(!zsdescs[1]); - __zs_unmap_object(area, (struct zsdesc **)pages, off, class->size); + __zs_unmap_object(area, zsdescs, off, class->size); } local_unlock(&zs_map_area.lock); @@ -1750,16 +1750,16 @@ static void obj_free(int class_size, unsigned long obj, unsigned long *handle) { struct link_free *link; struct zspage *zspage; - struct page *f_page; + struct zsdesc *f_zsdesc; unsigned long f_offset; unsigned int f_objidx; void *vaddr; - obj_to_location(obj, &f_page, &f_objidx); + obj_to_location(obj, &f_zsdesc, &f_objidx); f_offset = (class_size * f_objidx) & ~PAGE_MASK; - zspage = get_zspage(f_page); + zspage = get_zspage(zsdesc_page(f_zsdesc)); - vaddr = kmap_atomic(f_page); + vaddr = zsdesc_kmap_atomic(f_zsdesc); link = (struct link_free *)(vaddr + f_offset); if (handle) { @@ -1771,14 +1771,14 @@ static void obj_free(int class_size, unsigned long obj, unsigned long *handle) if (likely(!ZsHugePage(zspage))) link->deferred_handle = *handle; else - f_page->index = *handle; + f_zsdesc->handle = *handle; #endif } else { /* Insert this object in containing zspage's freelist */ if (likely(!ZsHugePage(zspage))) link->next = get_freeobj(zspage) << OBJ_TAG_BITS; else - f_page->index = 0; + f_zsdesc->next = NULL; set_freeobj(zspage, f_objidx); } @@ -1836,7 +1836,7 @@ EXPORT_SYMBOL_GPL(zs_free); static void zs_object_copy(struct size_class *class, unsigned long dst, unsigned long src) { - struct page *s_page, *d_page; + struct zsdesc *s_zsdesc, *d_zsdesc; unsigned int s_objidx, d_objidx; unsigned long s_off, d_off; void *s_addr, *d_addr; @@ -1845,8 +1845,8 @@ static void zs_object_copy(struct size_class *class, unsigned long dst, s_size = d_size = class->size; - obj_to_location(src, &s_page, &s_objidx); - obj_to_location(dst, &d_page, &d_objidx); + obj_to_location(src, &s_zsdesc, &s_objidx); + obj_to_location(dst, &d_zsdesc, &d_objidx); s_off = (class->size * s_objidx) & ~PAGE_MASK; d_off = (class->size * d_objidx) & ~PAGE_MASK; @@ -1857,8 +1857,8 @@ static void zs_object_copy(struct size_class *class, unsigned long dst, if (d_off + class->size > PAGE_SIZE) d_size = PAGE_SIZE - d_off; - s_addr = kmap_atomic(s_page); - d_addr = kmap_atomic(d_page); + s_addr = zsdesc_kmap_atomic(s_zsdesc); + d_addr = zsdesc_kmap_atomic(d_zsdesc); while (1) { size = min(s_size, d_size); @@ -1883,17 +1883,17 @@ static void zs_object_copy(struct size_class *class, unsigned long dst, if (s_off >= PAGE_SIZE) { kunmap_atomic(d_addr); kunmap_atomic(s_addr); - s_page = get_next_page(s_page); - s_addr = kmap_atomic(s_page); - d_addr = kmap_atomic(d_page); + s_zsdesc = get_next_zsdesc(s_zsdesc); + s_addr = zsdesc_kmap_atomic(s_zsdesc); + d_addr = zsdesc_kmap_atomic(d_zsdesc); s_size = class->size - written; s_off = 0; } if (d_off >= PAGE_SIZE) { kunmap_atomic(d_addr); - d_page = get_next_page(d_page); - d_addr = kmap_atomic(d_page); + d_zsdesc = get_next_zsdesc(d_zsdesc); + d_addr = zsdesc_kmap_atomic(d_zsdesc); d_size = class->size - written; d_off = 0; } @@ -2200,7 +2200,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, struct zs_pool *pool; struct size_class *class; struct zspage *zspage; - struct page *dummy; + struct zsdesc *dummy; void *s_addr, *d_addr, *addr; unsigned int offset; unsigned long handle; From patchwork Mon Feb 20 13:22:01 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: 13146436 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 42F16C636CC for ; Mon, 20 Feb 2023 13:22:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D2E2E6B0080; Mon, 20 Feb 2023 08:22:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CDF8E6B0081; Mon, 20 Feb 2023 08:22:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7F816B0082; Mon, 20 Feb 2023 08:22:58 -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 A9BDD6B0080 for ; Mon, 20 Feb 2023 08:22:58 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 709BCA0994 for ; Mon, 20 Feb 2023 13:22:58 +0000 (UTC) X-FDA: 80487735636.25.B82B048 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf11.hostedemail.com (Postfix) with ESMTP id 91F634001D for ; Mon, 20 Feb 2023 13:22:56 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=aXlF5sZp; spf=pass (imf11.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.48 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=1676899376; 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=vOHr4kwn4dxg23tNChjWJmg9YRUx5gIQnzpZr67MPeo=; b=JfzZsspUNB3lsmA4zOSCPjAarGygAEVx/+ktlvpRRkvOU/+pmcpkczPMAh6MRc//xK1hkR tbdAQ+s4CdjVB0vF+o5nwgLdXXw3XLiQT6kMWzSuYB99yCqR12GcTooE+FJlJexu2uCFtp Av0ICGFb6DYp2i63HjPKt99Sej6qySo= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=aXlF5sZp; spf=pass (imf11.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.48 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=1676899376; a=rsa-sha256; cv=none; b=btVlRxjfWSPo+6cCWllMJasCmh5zvOXF5S3AaKYYZAFXtB8PX8XspTIWqKboOFhN2CCsZl yN1Vim7qYX+q9sQm0PTBoj7h5XvoEO5vxw9wRlhLOP6iWGomekOLucMhKnQuh3FCMPnnbf Kxv6ulvmI4bhQMMMRpgk7QeW21sNLCw= Received: by mail-pj1-f48.google.com with SMTP id oe18-20020a17090b395200b00236a0d55d3aso1829342pjb.3 for ; Mon, 20 Feb 2023 05:22:56 -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=vOHr4kwn4dxg23tNChjWJmg9YRUx5gIQnzpZr67MPeo=; b=aXlF5sZpldikjxWRJ/my5E+ingE1RhF8dVifICaQk2wDUTNUW5F5nTQoCEz+XzdNwc 2TQWxjTjjrYetNz1AP1BET+Uzc5Vnu60m7iwGvQQIm0D+4cCAqLtK+2A6L6AEQU8xKdf kqOurraEIhRY3updQhz2i42CN5t2wCVUX2e/BYiuWDhu7y2c9hce2/Y4Xbx3wLGTR/kA XDM9PM9ENgUZGw3ypTcgxu2zMLlIXGz+HM/yOBWRXvRHbemhjIunzZw0ZcYSOVYLfR45 SdPcyWb+dOH18+aVGqEGe4nPly4ESVy/0phlpIKq2lGCLpsRZFymD6oy2y0BodQ1sWqc O8pQ== 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=vOHr4kwn4dxg23tNChjWJmg9YRUx5gIQnzpZr67MPeo=; b=xUD0UTs7UmHDbZTKXPPyelpQ2Yufc/M33qYrLGGja4/8obJdZak+67/2nOEnPiPBYE Rs51fzVC/6WEOPlePDKaNpIrqd1Aj2kGKjCXDrVy/8Is0i+kka3TQEpBmkGFezf07K/J FhUznudwOwNWjfpj/HdjEXQp23OGYSBsiIUOFM3QQ6ehZToMVcvtT37bj5lgbSXkUlQw fCBT/fW9ajSXwjyzb7yAdGpeIqWPGPmhm1jhY3npEOn6h1rtiR31+tgrD4YdvQHLOZur 7CV86w424QnXTfhBS/pzi50r3lv3+doWqVyh+ytttuF52/6xHKS4oNgXthTTk1OP+2+C AGrA== X-Gm-Message-State: AO0yUKVho7JMbHvjGE+Wr+luL/+mZMdxZPp7rY4cfYrXD7CG+a902G+j WD85TjPr1pwhh2eS9lP8b04= X-Google-Smtp-Source: AK7set+KtKzsqqJ9T/y0lDan8IQgQ33wV1mEcFH9zQLcXwlNElKMBTWvbl2+6vuSwVgcAI+VMow1Tg== X-Received: by 2002:a17:902:f9cc:b0:19a:f556:e3b6 with SMTP id kz12-20020a170902f9cc00b0019af556e3b6mr899104plb.32.1676899375531; Mon, 20 Feb 2023 05:22:55 -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.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:22:54 -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 08/25] mm/zsmalloc: convert obj_malloc() to use zsdesc Date: Mon, 20 Feb 2023 13:22:01 +0000 Message-Id: <20230220132218.546369-9-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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 91F634001D X-Rspam-User: X-Stat-Signature: 9ttkt7xfgtbrjnqesk15ag85rngz1wcg X-HE-Tag: 1676899376-428003 X-HE-Meta: U2FsdGVkX1/0YR/qj7ku8GdaoxhNUIGobI5Qh7sVUdX3RdHB1PaRvdorAn/sQD8wJ9UdDBvwKZr5qXn/Zv+fwVMI5XVYIcLAdo+dEEPKn/2cl0+ZGm928HwVRR699YTkVRHcqws48ZOB2+30rmoASEZt7PLYbbWYjnm2cG1S32i3r61CYdbwRAcaP6hQBQprA2zVhqcIHwECzc7Myz4supi0yxdNlkSGtuLDT7xAhmd6kzJvomAmAUdd3GVU6XACQEO9/DK3LNxW0XQEb5SoncawovBCfsMOprkyzBSzIIwAf47r560dUiJgoTYysIR3A/3PFdCBGAEwMQyvgIuBVjEM31y5HKsPz8/9Sg6VbYAh9aoT8kJ6bNmcXvlzCb46GGphYiUAt7spRf5ywJyKhtNTg+PBMnZY2XHA4OQH4Uksr3ogWwSm3N97QoZSpmFoScldPHl27mWV3q9D9lpjU5EvxjdaQC8ljVUSiYowBANY1faBgHbJVUT7+4x6088M7xwKzXYGW1mJRoe+qcAm4k89zAJ6fbtGzEmxmu5gr7Wllydkfq+pcfxG5Y94SDiNX0wcRNVeTVAeytFAn+XM1p+WP+RkMmS/z9Id7C8w6OzykOKiHowk/roowFj2/qZ0d7DNfiyNB94iuf47x0ACfQ1EXW3NYmUme5qk1zPNZ1wWN0PhluFkEkdh0iI/kgZnROClHqoqAB/iVR17E6TK7zqdSRpCKnlRM9+7+w3CJaYwwqpU9RO5CD/PQQoTSeZD1gb3/HnwDN6BSFu2GQg0wwgDb1cXe0UrQZIh9JXPdflNFE6CSpvDKi1yndG8D31SJ3ZeuEHCBup9lFz7yUAN9fSd8+S/Q1cWTz71yDUZjTlr4LZ/PEUv/GirpqakUz8P1IUxWhyPPF9JCJ1enanx5ZKzf78lrYxP8Rbkves90YEGyCh+z3YmBWwiEz9Ik+fvKzXDLXCQEZILrjCg2H1 DfQex2WD HOrSZGW9PDFxNRtirosXx9mBVosEXvpKKIcC3uD9F4Ra3w4BPXtYlcXkJUGGXu26gOjPoeGg4EwSvL47Q9Nf5kTxXzVC7CU3kOYp1YJqk3ULzodAT/C82gutZG+3WCdlIrOQR5v3r0fBn+HVExpKKnNmljxJgj0GiEx/tWpBEeI0tAcb1wCEg7r2ZY+Rrcj68VRSy6t8UVYyjuCO8IFxvNMY3fOPJBEv8008bC/pPILmRvqKRXFO8PFbnHmwAOB1p9Edm7XHJHWNMlGqN8I/+L1/ixgtnDSHSP356BY2U5CDaShV/BdcTk/WTPkhVJlX0cn0VFS+600sRCByeX9TKrF9TYUEfF3h0Rj/tDrrYGJ7Y68CpHkpEDpko7EG2DHVfk4IoUvHw18GCUTAcU4amai/Sqrxyxh6/JuZtMO6xnpbk39dIcNPgMsMmdTsEAr4v8Deoc4QN4puM15PMrY992HgXDzTKcOesSNwOZL5bW8aRCQFtD7zk+s1w6RcnoBNXF5Vp+hWeAQ6pG8f2d28+7+h3gLj/bhLZYGQauy7e2J3jHr+T4F0MnmdBOL4OWIWQvT9ugRep8FjJA1UZl0m/g54npkT550ou1Pk8 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: Convert obj_malloc() to use zsdesc and replace helper functions with new ones that take zsdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 56cb93629c7f..4386a24a246c 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1637,12 +1637,12 @@ EXPORT_SYMBOL_GPL(zs_huge_class_size); static unsigned long obj_malloc(struct zs_pool *pool, struct zspage *zspage, unsigned long handle) { - int i, nr_page, offset; + int i, nr_zsdesc, offset; unsigned long obj; struct link_free *link; struct size_class *class; - struct page *m_page; + struct zsdesc *m_zsdesc; unsigned long m_offset; void *vaddr; @@ -1651,14 +1651,14 @@ static unsigned long obj_malloc(struct zs_pool *pool, obj = get_freeobj(zspage); offset = obj * class->size; - nr_page = offset >> PAGE_SHIFT; + nr_zsdesc = offset >> PAGE_SHIFT; m_offset = offset & ~PAGE_MASK; - m_page = get_first_page(zspage); + m_zsdesc = get_first_zsdesc(zspage); - for (i = 0; i < nr_page; i++) - m_page = get_next_page(m_page); + for (i = 0; i < nr_zsdesc; i++) + m_zsdesc = get_next_zsdesc(m_zsdesc); - vaddr = kmap_atomic(m_page); + vaddr = zsdesc_kmap_atomic(m_zsdesc); link = (struct link_free *)vaddr + m_offset / sizeof(*link); set_freeobj(zspage, link->next >> OBJ_TAG_BITS); if (likely(!ZsHugePage(zspage))) @@ -1671,7 +1671,7 @@ static unsigned long obj_malloc(struct zs_pool *pool, kunmap_atomic(vaddr); mod_zspage_inuse(zspage, 1); - obj = location_to_obj(m_page, obj); + obj = location_to_obj(zsdesc_page(m_zsdesc), obj); return obj; } From patchwork Mon Feb 20 13:22:02 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: 13146437 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 63748C05027 for ; Mon, 20 Feb 2023 13:23:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BCE756B0081; Mon, 20 Feb 2023 08:23:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B7F326B0082; Mon, 20 Feb 2023 08:23:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A203A6B0083; Mon, 20 Feb 2023 08:23:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 90D566B0081 for ; Mon, 20 Feb 2023 08:23:01 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 63E581406F7 for ; Mon, 20 Feb 2023 13:23:01 +0000 (UTC) X-FDA: 80487735762.29.193F394 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf22.hostedemail.com (Postfix) with ESMTP id 68984C001D for ; Mon, 20 Feb 2023 13:22:59 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="AKns/q0d"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.49 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676899379; 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=LmknqlF2BVMkgwnYUzvUrAsPXq6CGDnWGEGBtOvFYx0=; b=DMG34tYlFUL6sMh22ydlFzGSzJ7yutezu7jgu3QGS3niZ1/6nHqCmZ1haqsTAwCZMCNqXM A3BMLj2+lvcXm6JisU6EX3dnwROiE50dUXt255NpKAwpqDvo9PM7Q9YxXC9hD0cvL9bJja uPd45YOhqNuU7aVC4EjeU0VFSMfZvJ0= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="AKns/q0d"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.49 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676899379; a=rsa-sha256; cv=none; b=Lw21ZRfQTE4pe31DBqF8FFFYq8K8Zxobm31VbYprUGwv01TmeGyWB9c44qLCKZO/3rqIut jbSG2ROGEuVRbabz0RhCIVGwyxVVUCLwPQuyzsKrMD+5+lkGabtDbL6e9jxC1mzlTpTISp Xgmya1J0skY4eyxizGhjJ9j0AMKMRXs= Received: by mail-pj1-f49.google.com with SMTP id co23-20020a17090afe9700b002341fadc370so1374665pjb.1 for ; Mon, 20 Feb 2023 05:22:59 -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=LmknqlF2BVMkgwnYUzvUrAsPXq6CGDnWGEGBtOvFYx0=; b=AKns/q0dWCNsi+Q0WJs0KmVkRxy9UgpXDmnrZCvdQ+bF7fvheAPeJybGESt98RBSBw q3Xz4iq1g2TsO3ikScytlU6/I+EjfAn6t0gBP2oQQwMoFFi7qo3BQGG2GcOs0CvzBBtc jyeABx8Uup0uNj7DS/XOddomldDfopbDokqkwJksR7DQAgc5E3RTd/Ua8NXAboWY6Ltq p54DgQDK5kalaSai1qg9PcVSlpHHdCcmxOgDKWdgMeFDnhCgTfoQQEVi68vKoPwKf2wg BAeZT8i9Bk9QF8BePqW/GxvXdByXhsyC773MqiPe+F83GllkySPR6a3jRgqavOP36D+V ZY9w== 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=LmknqlF2BVMkgwnYUzvUrAsPXq6CGDnWGEGBtOvFYx0=; b=EPhPdbMJCsFiEBfhC5pT9DJ6gLJfPcP5YygN/V4ZDxdzP+ZTzY5cbdtfdv4Nsm7k5A YOHBVyNSKUocdRLD1Xx5zXdMwx/70cZAe0vQin6w82tdLfS6yxU60pPhqBJY47E/omY1 ZqYcA0/EQL/rrUTCB6WMOm47lquWdeC3aUZlhr3OL7sj5UYw6WAUDbH8sUQPn6KRbyR6 XZvdtXzt8Etsr0KAvA3D5UX/s4arlF5NHj+OrFE/6qzKNdzXOy27CMLgZflX6Hg2/XO+ C7qS4TvrSIbN9dZmxMEtaIF1J53oKqGpAGPPoW0wCKup264sdezi9Ge7BWYwupqUz0qh PHVg== X-Gm-Message-State: AO0yUKWrhaXI1lTzV5zbnbOb7zkMFPLgxdD/U8XZo8Hj+/G6t8CXuBg9 PWmofgYqv2PnzAhG4t8frzEAr5mFar9bFg== X-Google-Smtp-Source: AK7set829BmS51GF4J4REjokHwIstpy2gNmJ7yItnok5kIcoVF/xsQMadDBkyMgsu+0b9h5j7fbVAw== X-Received: by 2002:a17:902:c40d:b0:198:e13e:e73e with SMTP id k13-20020a170902c40d00b00198e13ee73emr3264330plk.53.1676899378260; Mon, 20 Feb 2023 05:22:58 -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.22.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:22:57 -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 09/25] mm/zsmalloc: convert create_page_chain() and its users to use zsdesc Date: Mon, 20 Feb 2023 13:22:02 +0000 Message-Id: <20230220132218.546369-10-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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 68984C001D X-Stat-Signature: dx15hu5sn5xh6t7rbky9uo5qhbygnyfe X-HE-Tag: 1676899379-533135 X-HE-Meta: U2FsdGVkX1+LCgRtFAOAw/zpqJow1pFSVE76aGhxo+sqxzsW/SC9Aoy4813Scbn/wvDuc82OHma7W0e52U2kn1pCrbX6jTiGAMMKk8U5Pj1Svez+IzR/kUaZYAiYGmtdDLNSVyKJV+UCnw+TVg53mhyKJPo7cEnCk7cIaH+pqGKnqjyaSL4epWsWvGFzJk5uXjc+HyGgpYgJzvA545aoyGo2/faGUlrItV8kGJ+QVS6MWrK0ntOWUWWmacL5sEtG3DHP4sAhn8WPqe6mP/dMAiZVdTEaZnWhPOIgb+tDWDKC8gWiEHMTAHXsoU57CqCJvP3DBJo8bkx5pHT3XK+2pDoybHQG0jUUOI1KKfeZRWsGV1/Q07UT7A33YgFZXebzMjKcNeMOI52oXa2eb6qvlb+oJ2CLSIc5DX03VyFZBNocVKjpT47EFbN0d0iaP0oQCdJozKRRH5oyRFypT7TzmqO7nuvALpmkoz2ICl+wcdwvozN2qDSjsPiyuzPMl66g2Mgc22CifxlI60/U7mlJSxnccyC0aKxGcI+X3jh3e42eQJrkGSDI9IcDIHgzAiJjMjs6q9KUiT3aWcoV2ej7eHAyRlsJFqYHqS3POytV6zZq04xfdp8OrXUz6KMl51fiME2fi9pYR4epU/IvY4xroeHVp3ZVrnl6UdaBK0Q7kpt3VZOAfFylvqy/DKD/Hx5KB0LmKRkz0tsdlJkXrIKGLLTs/3g1L60dhmXAes8tOp93OC1JDlXzS6Tye9gPLAC81TVumOS15cpM6X8z+sftFyzOIF6ex9XmBUX7M6run5z48jXucRi/jAmHRRqQ83PS+EAqQH+LXzaScZ5BNqA1nHkix/mKN6SzTOPVnHfPzzHxOL7uDMlXuuhnQIWtPrq2Cdkf8whU9yXiWi/SawPQRy4UDNSbCX3Ih4XuY4FDReBcIWdVaujHGkgdpzBhxP7zrVOU7hVotjuZlVdP42Q wJZqLD9w XgS9alSsRlo7esh1O0lFRWnLte3GfEgxngLLNQvzHpPa+XBWdjfPEybqBacinyfNnvfDUW6nsY4CSZpVmTQV1zsRFKQOyb29me5CWYF6mpJgEXLv+BcdzQ5Typ+V4XIU6tjyPB4PGnwdZj4otpFwtpbWR5824TlVqkFhzGUksQ17NYeigusZ5m4fjKPe7ZFFKYsRJH4dhAatCWbthX08196y5bWA3OgZnN4IL9+BN1uPpoPjTidbK5JG9Q79UaZFrwV8GArP+CS2aZPHSgllTO5Vwdb7u0Owv6hspJW66Weq+0L5TZ0dbNQMYsgF+Tqj3nnLRA2vNib3vkAOTqewFVgCinujA1YAbp54K0s0Q8lS10QVFEZP3w1u0/t5O6b3cDqrjyoyq5XDtylGsU35x5J/i9FLKxWqFYD+C0fliiYuPzsqbFih0BqsmWyWLUftHdyT+neNRRF+YIEJAdDDDjdTQUJPx5SBuOhYBQ7y66wys6AFphtx0Q7bwmIKXSOu7qFSeVWb7hHzocCyQLmdkjSnwf/NsvFF7QaXj8Osx84JEqk85WOH4PxVPTSsILV1h5Y53l6RZcpRdex/enaqXHBRxaQ4uUJs5FrkdQCtmUxMWle+gWUHltpYF9YFECDHHPZFBjY7xg2QKs8Y= 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: Convert create_page_chain() to use zsdesc and rename it to create_zsdesc_chain(), update comments accordingly. Also, convert its callers to use zsdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 80 +++++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 4386a24a246c..c65bdce987e9 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1251,36 +1251,36 @@ static void init_zspage(struct size_class *class, struct zspage *zspage) set_freeobj(zspage, 0); } -static void create_page_chain(struct size_class *class, struct zspage *zspage, - struct page *pages[]) +static void create_zsdesc_chain(struct size_class *class, struct zspage *zspage, + struct zsdesc *zsdescs[]) { int i; - struct page *page; - struct page *prev_page = NULL; - int nr_pages = class->pages_per_zspage; + struct zsdesc *zsdesc; + struct zsdesc *prev_zsdesc = NULL; + int nr_zsdescs = class->pages_per_zspage; /* - * Allocate individual pages and link them together as: - * 1. all pages are linked together using page->index - * 2. each sub-page point to zspage using page->private + * Allocate individual zsdescs and link them together as: + * 1. all zsdescs are linked together using zsdesc->next + * 2. each sub-zsdesc point to zspage using zsdesc->zspage * - * we set PG_private to identify the first page (i.e. no other sub-page + * we set PG_private to identify the first zsdesc (i.e. no other sub-zsdesc * has this flag set). */ - for (i = 0; i < nr_pages; i++) { - page = pages[i]; - set_page_private(page, (unsigned long)zspage); - page->index = 0; + for (i = 0; i < nr_zsdescs; i++) { + zsdesc = zsdescs[i]; + zsdesc_set_zspage(zsdesc, zspage); + zsdesc->next = NULL; if (i == 0) { - zspage->first_zsdesc = page_zsdesc(page); - SetPagePrivate(page); + zspage->first_zsdesc = zsdesc; + zsdesc_set_first(zsdesc); if (unlikely(class->objs_per_zspage == 1 && class->pages_per_zspage == 1)) SetZsHugePage(zspage); } else { - prev_page->index = (unsigned long)page; + prev_zsdesc->next = zsdesc; } - prev_page = page; + prev_zsdesc = zsdesc; } } @@ -1292,7 +1292,7 @@ static struct zspage *alloc_zspage(struct zs_pool *pool, gfp_t gfp) { int i; - struct page *pages[ZS_MAX_PAGES_PER_ZSPAGE]; + struct zsdesc *zsdescs[ZS_MAX_PAGES_PER_ZSPAGE]; struct zspage *zspage = cache_alloc_zspage(pool, gfp); if (!zspage) @@ -1302,23 +1302,21 @@ static struct zspage *alloc_zspage(struct zs_pool *pool, migrate_lock_init(zspage); for (i = 0; i < class->pages_per_zspage; i++) { - struct page *page; + struct zsdesc *zsdesc; - page = alloc_page(gfp); - if (!page) { + zsdesc = alloc_zsdesc(gfp); + if (!zsdesc) { while (--i >= 0) { - dec_zone_page_state(pages[i], NR_ZSPAGES); - __free_page(pages[i]); + free_zsdesc(zsdescs[i]); } cache_free_zspage(pool, zspage); return NULL; } - inc_zone_page_state(page, NR_ZSPAGES); - pages[i] = page; + zsdescs[i] = zsdesc; } - create_page_chain(class, zspage, pages); + create_zsdesc_chain(class, zspage, zsdescs); init_zspage(class, zspage); zspage->pool = pool; @@ -2153,27 +2151,29 @@ static void dec_zspage_isolation(struct zspage *zspage) zspage->isolated--; } -static void replace_sub_page(struct size_class *class, struct zspage *zspage, - struct page *newpage, struct page *oldpage) +static void replace_sub_zsdesc(struct size_class *class, struct zspage *zspage, + struct zsdesc *new_zsdesc, struct zsdesc *old_zsdesc) { - struct page *page; - struct page *pages[ZS_MAX_PAGES_PER_ZSPAGE] = {NULL, }; + struct zsdesc *zsdesc; + struct zsdesc *zsdescs[ZS_MAX_PAGES_PER_ZSPAGE] = {NULL, }; + unsigned int first_obj_offset; int idx = 0; - page = get_first_page(zspage); + zsdesc = get_first_zsdesc(zspage); do { - if (page == oldpage) - pages[idx] = newpage; + if (zsdesc == old_zsdesc) + zsdescs[idx] = new_zsdesc; else - pages[idx] = page; + zsdescs[idx] = zsdesc; idx++; - } while ((page = get_next_page(page)) != NULL); + } while ((zsdesc = get_next_zsdesc(zsdesc)) != NULL); - create_page_chain(class, zspage, pages); - set_first_obj_offset(newpage, get_first_obj_offset(oldpage)); + create_zsdesc_chain(class, zspage, zsdescs); + first_obj_offset = get_first_obj_offset(zsdesc_page(old_zsdesc)); + set_first_obj_offset(zsdesc_page(new_zsdesc), first_obj_offset); if (unlikely(ZsHugePage(zspage))) - newpage->index = oldpage->index; - __SetPageMovable(newpage, &zsmalloc_mops); + new_zsdesc->handle = old_zsdesc->handle; + zsdesc_set_movable(new_zsdesc); } static bool zs_page_isolate(struct page *page, isolate_mode_t mode) @@ -2254,7 +2254,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, } kunmap_atomic(s_addr); - replace_sub_page(class, zspage, newpage, page); + replace_sub_zsdesc(class, zspage, page_zsdesc(newpage), page_zsdesc(page)); /* * Since we complete the data copy and set up new zspage structure, * it's okay to release the pool's lock. From patchwork Mon Feb 20 13:22:03 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: 13146438 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 CC89BC677F1 for ; Mon, 20 Feb 2023 13:23:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 650676B0082; Mon, 20 Feb 2023 08:23:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6013E6B0083; Mon, 20 Feb 2023 08:23:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47A3D6B0085; Mon, 20 Feb 2023 08:23:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 350586B0082 for ; Mon, 20 Feb 2023 08:23:04 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 119781602B4 for ; Mon, 20 Feb 2023 13:23:04 +0000 (UTC) X-FDA: 80487735888.05.FFBE299 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by imf20.hostedemail.com (Postfix) with ESMTP id 13C7B1C0012 for ; Mon, 20 Feb 2023 13:23:01 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=lORX6IoC; spf=pass (imf20.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.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=1676899382; 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=3RJDtWutWGogP0/7qEs8fcsETlU2jUWF08HBLcLJ7gQ=; b=Kwo81bJoUuWUafancpRmCdOK5bwHu11v5FPosr1vv8N2HFfiwN6DvAffzWDCdc33fkkk+5 FYmEjSbSrVpquqBTM86NfS1Ac0mn+ix/lycJmA0l+n4xxvcLr8v0HpeVUZuIKAuWtvtyHR l+6td3ww+SdRY7x5cuzYUuhlrJsD3Fk= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=lORX6IoC; spf=pass (imf20.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.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=1676899382; a=rsa-sha256; cv=none; b=UEllnd0lwyfNUFdU/9Qbk6PwxBJ0eoaU4stqZkJSxNQHhRtAUHGXY+Id1pV+joyNSaW9SL uwb0ZBfrc0oGDwXr/rjYWXyydhmZADzz8skOVmz6K75XZjWWmI5RmPf5vSBZCbk/7yMamj 6LYg1gk/0miIcEijDUWsPUe630pLmZk= Received: by mail-pl1-f173.google.com with SMTP id ko13so1974170plb.13 for ; Mon, 20 Feb 2023 05:23:01 -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=3RJDtWutWGogP0/7qEs8fcsETlU2jUWF08HBLcLJ7gQ=; b=lORX6IoCM3PB5Az4NBW+udpMDI6V3OLgqBSAbrUnBMP3LiDZ/1kHDYV6mminU8d6yM JkSQ+gFwTcE2fZp4ivrq5gjbZijq7o+qm+n3D6tYuRkm8un7pMrhjBEY1yy0mQZufS9t NsMvSZ4elhdgplLrSFlFVr9UXL0UK715ydao+odimrSQ5xMvZPOmLBiqk30iPM5Anojk TsBYYRn24v9RMtK8o7o5h6ySY4r7fAoG9Gk28ecRmcWvY0/+VkhQn6/Gjr4AvKn0Q12N FBxn9vg9H9ZdunHRoXwKvOuccRwb9NxDkRGd2ST8bmri/jNpvWp6eMFQ2eiew8SKiiyv P7aQ== 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=3RJDtWutWGogP0/7qEs8fcsETlU2jUWF08HBLcLJ7gQ=; b=WSnfzXVvkQmmj+ZIGMfM2ntrXV0ohxkxiTS3zcp51jCIJJLNW+m3OyEQ6ZN+gdmg3N QW7vXwAiQtXzYYSCY7UwUp2Nutf3LXoOSPrG6vl6zfhdFPCcc1xt+BFGB3B1xPCuezgJ 5VAsNEhKeryWjNe03DmHOfrO4XWpb21/PsE6DnaaDGvFxJyYPXfw7uB9wIvPq5T/Pe9q mqdgh4M4P6IiAt/S5S2WfOaods2e5AnHzzz7bVhuh3+ZEYjvoYH23ZfZeD0Itt5x1OCs px/UQP0lzUccMMFusYLEMk2bvEDNlkiMkVWLZA9lEdYbSafyX8wesvbhhZrHoWXRSrcx 8wGg== X-Gm-Message-State: AO0yUKV1+J3hrQcFaXu5merdbbVsDoip/qVEdnJEgv/BdLllMLWT4iWE uYji4qwJYLhg4eJiCp/PLmw= X-Google-Smtp-Source: AK7set/2aKvQ5D4xiB6CLXNU7eah3aEC4doXJh4aSOvsCsJ/l2tQLy/HmNh6KCEWM0Q61QunR8TGdA== X-Received: by 2002:a17:903:41cd:b0:19a:a9d8:e47f with SMTP id u13-20020a17090341cd00b0019aa9d8e47fmr3580367ple.36.1676899380903; Mon, 20 Feb 2023 05:23:00 -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.22.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:00 -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 10/25] mm/zsmalloc: convert obj_tagged() and related helpers to use zsdesc Date: Mon, 20 Feb 2023 13:22:03 +0000 Message-Id: <20230220132218.546369-11-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-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 13C7B1C0012 X-Stat-Signature: 3aq96qzik7bgw1souocmcu37u8q7y83z X-Rspam-User: X-HE-Tag: 1676899381-943476 X-HE-Meta: U2FsdGVkX19KRoP4Vs/Ffcv46ZHfLoyVq69PgkVTMMntr3PjEzpdk3WaKWKPZSpn9jrCbB9c0F4HFnnPAzbBW0G+f515uY8N1QfbH0IWubn864EjHFh6tWgTmLGYAP4TcluBCIkdxbbyQgG2GEBfaHAekki7e9vJaWGYn+zQjbMS5dUwVem4IeHTaxcuqnDP84TZH/luxw/Mn9aFpU0wnxF768usQ+6s9wgkYBWuvT57MWyptxmLufkMlrvRPFX0aO61GIRztqHujyIDdAbDZHMBnwBamG0UWv8TSPQjj++cW2IlS7gB7D/fQVaGTXo/Y/BGHa+6fEJW3dH+yrr5UOvVhT98ebxD6x1Co990i+t6LbA6SqPfGBO8Qp8GG2EBPTb3SCOk296VP5Q/2Y8me2saN4PkY7O2iBkXk+PAliKmFvn5ennQk98lIGE+krOF8MUYLsCvOzRLI0h1TX+SMmIS8xcqMo+jU0YLhQWv/4trf3yZlPumHx79ze2mOJovd/aYDwbg4MSW2I6j6oliy3hnFPePTYy27ln/ngW3vlbN3djBAsvR5IukVkcxDJZLEzYcqQcSjZXcfBMb168+r6R9UWa4amR/IWs83l8YAXatnwpzkDsOxpByfGNgU40qoy5An9Ik5HK3wft5gqPJTHvcdRfoleWZLuKooAxnJ0tvVasFdsegF7jryyVYS690930coJ4j1j56C2W4JZsG1ZuU3PM/n4QejbBuPkFaBkuRBv8NzvFw634dUHAd/Xx/wpuE500TVM6Qbf6VK6DHV3o3VnJEes/QLFYZcvXv0q0uIL2qSFbXfFU5UYwWmHYAiiD0MEaIzxzNaKztxbe7s9bp2Vyi8MHFsbbcS743oFQhIVWM6Ev9XEt9Fo5vN4N4uGoiarhb0OoiwD0SlDgYZkJjqishe7gmBwnT+VcqnNLXZyETWI16rQqgbg03f/7bnwAqOsk2qYWegjAODl5 Pt1KdFeb kae2b3jTQZ4nckjMjQZ5UbIm0KB/gS+3uH4wsB83I8KgM6/Me00kE9F0ybxYmq2sXkrLutYabO1HKFVYgNv2C1GCp1uv0dPp/sBJtR71GbGc8xKTxkTMouvk49yrBnYd3/LQm+6vT/pRLDfKv/L3c4VVRU89Z25LYUptiiYYd5CND7e5ihDaBMF35lOPDHJg/JgfP8g4O5/790vP+j7dfnHD18toioQcAwz55zJ2Ip5czXJJFgEvLuDlScpYsriKkHMy4XNcimtNV3FPqrgi6KAr82iFF521UJwPmzQ4xuoOMlYyWwnw7MXP2Mt+LS5HjwWgOqYRlGz2ukN+Ufe4oVWylIxYNn1jFNwz6fgeNRP8thcXR29+jtr68yMH1WMugi+h3wDFNEc7CB5rWjv38KQUBgvLP45lwRceSg/HfPCmUYZC3QXfa5D/Z6PYbrFF/fwXn/KZ1IdPh1Y3GBQZGT3oDua2a+3HfaddZYYYbQlcLl6u7Q9tLoCYGq43GX9jWWQNJYhasXhTNKTFiJwKhwICd9u9iiaTt35Q1btejhJedpOAvxtjsSEs8Jh9Vk5siqDwjqLRIQwWhyqwRloj/xQovO0kuNfZ8MOyL4Zvm6TZfCYyBzqpnVhVHLIS7elF+vIA9k3YQw2h4nCM= 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: Convert obj_tagged(), and related helpers to take zsdesc. Also make its callers to cast (struct page *) to (struct zsdesc *) when calling them. The users will be converted gradually as there are many. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index c65bdce987e9..e1262c0a5ad4 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1047,15 +1047,15 @@ static unsigned long handle_to_obj(unsigned long handle) return *(unsigned long *)handle; } -static bool obj_tagged(struct page *page, void *obj, unsigned long *phandle, +static bool obj_tagged(struct zsdesc *zsdesc, void *obj, unsigned long *phandle, int tag) { unsigned long handle; - struct zspage *zspage = get_zspage(page); + struct zspage *zspage = get_zspage(zsdesc_page(zsdesc)); if (unlikely(ZsHugePage(zspage))) { - VM_BUG_ON_PAGE(!is_first_page(page), page); - handle = page->index; + VM_BUG_ON_PAGE(!is_first_zsdesc(zsdesc), zsdesc_page(zsdesc)); + handle = zsdesc->handle; } else handle = *(unsigned long *)obj; @@ -1067,16 +1067,16 @@ static bool obj_tagged(struct page *page, void *obj, unsigned long *phandle, return true; } -static inline bool obj_allocated(struct page *page, void *obj, unsigned long *phandle) +static inline bool obj_allocated(struct zsdesc *zsdesc, void *obj, unsigned long *phandle) { - return obj_tagged(page, obj, phandle, OBJ_ALLOCATED_TAG); + return obj_tagged(zsdesc, obj, phandle, OBJ_ALLOCATED_TAG); } #ifdef CONFIG_ZPOOL -static bool obj_stores_deferred_handle(struct page *page, void *obj, +static bool obj_stores_deferred_handle(struct zsdesc *zsdesc, void *obj, unsigned long *phandle) { - return obj_tagged(page, obj, phandle, OBJ_DEFERRED_HANDLE_TAG); + return obj_tagged(zsdesc, obj, phandle, OBJ_DEFERRED_HANDLE_TAG); } #endif @@ -1112,7 +1112,7 @@ static int trylock_zspage(struct zspage *zspage) #ifdef CONFIG_ZPOOL static unsigned long find_deferred_handle_obj(struct size_class *class, - struct page *page, int *obj_idx); + struct zsdesc *zsdesc, int *obj_idx); /* * Free all the deferred handles whose objects are freed in zs_free. @@ -1125,7 +1125,7 @@ static void free_handles(struct zs_pool *pool, struct size_class *class, unsigned long handle; while (1) { - handle = find_deferred_handle_obj(class, page, &obj_idx); + handle = find_deferred_handle_obj(class, page_zsdesc(page), &obj_idx); if (!handle) { page = get_next_page(page); if (!page) @@ -1906,18 +1906,18 @@ static void zs_object_copy(struct size_class *class, unsigned long dst, * return handle. */ static unsigned long find_tagged_obj(struct size_class *class, - struct page *page, int *obj_idx, int tag) + struct zsdesc *zsdesc, int *obj_idx, int tag) { unsigned int offset; int index = *obj_idx; unsigned long handle = 0; - void *addr = kmap_atomic(page); + void *addr = zsdesc_kmap_atomic(zsdesc); - offset = get_first_obj_offset(page); + offset = get_first_obj_offset(zsdesc_page(zsdesc)); offset += class->size * index; while (offset < PAGE_SIZE) { - if (obj_tagged(page, addr + offset, &handle, tag)) + if (obj_tagged(zsdesc, addr + offset, &handle, tag)) break; offset += class->size; @@ -1936,9 +1936,9 @@ static unsigned long find_tagged_obj(struct size_class *class, * return handle. */ static unsigned long find_alloced_obj(struct size_class *class, - struct page *page, int *obj_idx) + struct zsdesc *zsdesc, int *obj_idx) { - return find_tagged_obj(class, page, obj_idx, OBJ_ALLOCATED_TAG); + return find_tagged_obj(class, zsdesc, obj_idx, OBJ_ALLOCATED_TAG); } #ifdef CONFIG_ZPOOL @@ -1947,9 +1947,9 @@ static unsigned long find_alloced_obj(struct size_class *class, * and return handle. */ static unsigned long find_deferred_handle_obj(struct size_class *class, - struct page *page, int *obj_idx) + struct zsdesc *zsdesc, int *obj_idx) { - return find_tagged_obj(class, page, obj_idx, OBJ_DEFERRED_HANDLE_TAG); + return find_tagged_obj(class, zsdesc, obj_idx, OBJ_DEFERRED_HANDLE_TAG); } #endif @@ -1975,7 +1975,7 @@ static int migrate_zspage(struct zs_pool *pool, struct size_class *class, int ret = 0; while (1) { - handle = find_alloced_obj(class, s_page, &obj_idx); + handle = find_alloced_obj(class, page_zsdesc(s_page), &obj_idx); if (!handle) { s_page = get_next_page(s_page); if (!s_page) @@ -2243,7 +2243,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, for (addr = s_addr + offset; addr < s_addr + PAGE_SIZE; addr += class->size) { - if (obj_allocated(page, addr, &handle)) { + if (obj_allocated(page_zsdesc(page), addr, &handle)) { old_obj = handle_to_obj(handle); obj_to_location(old_obj, &dummy, &obj_idx); @@ -2727,14 +2727,14 @@ static void restore_freelist(struct zs_pool *pool, struct size_class *class, void *obj_addr = vaddr + off; /* skip allocated object */ - if (obj_allocated(page, obj_addr, &handle)) { + if (obj_allocated(page_zsdesc(page), obj_addr, &handle)) { obj_idx++; off += class->size; continue; } /* free deferred handle from reclaim attempt */ - if (obj_stores_deferred_handle(page, obj_addr, &handle)) + if (obj_stores_deferred_handle(page_zsdesc(page), obj_addr, &handle)) cache_free_handle(pool, handle); if (prev_free) @@ -2830,7 +2830,7 @@ static int zs_reclaim_page(struct zs_pool *pool, unsigned int retries) obj_idx = 0; page = get_first_page(zspage); while (1) { - handle = find_alloced_obj(class, page, &obj_idx); + handle = find_alloced_obj(class, page_zsdesc(page), &obj_idx); if (!handle) { page = get_next_page(page); if (!page) From patchwork Mon Feb 20 13:22:04 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: 13146439 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 7FF43C05027 for ; Mon, 20 Feb 2023 13:23:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1BC2A6B007E; Mon, 20 Feb 2023 08:23:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 16CED6B0083; Mon, 20 Feb 2023 08:23:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 034B16B0085; Mon, 20 Feb 2023 08:23:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id EAEE16B007E for ; Mon, 20 Feb 2023 08:23:06 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B9B3FA07C5 for ; Mon, 20 Feb 2023 13:23:06 +0000 (UTC) X-FDA: 80487735972.17.E11420A Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by imf14.hostedemail.com (Postfix) with ESMTP id C76C3100007 for ; Mon, 20 Feb 2023 13:23:04 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=UAzHFdBI; spf=pass (imf14.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.52 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=1676899384; a=rsa-sha256; cv=none; b=WaVAFDHC5qijr5MaoFJZL2Y30ZamvX79tcMCMBrYdiT/9mGTRqfYffJ4dv8+sGNzXXFmvN BAImVL+m2QNPEQVggjqel+rAiuERoTgcTVR2ehxx6Cx6ptE6qT5TnOd/Otid5P1iFq9mKF 3wQQicOYO0QfTb8ZmcB3gqg7H4JqzTA= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=UAzHFdBI; spf=pass (imf14.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.52 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=1676899384; 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=AeeWLnjXmZb8t5JTf+jpvMzxuSa3RxnpJeCtpbomLHs=; b=3Q/bk/4pfvGX7u91YB7gVDq/Gxu/IhbRYgFVt51sTPlsiFJBFlYhl1sJ79Q4KzyOK+ieCm Y5ewAxXK2n2Lpz+6+9i6sEcUEhgNpM2opM2L4vkgjIjN5YZLRDEK7cU3LGBtu4CA2C/4wm RJ0CU3d4xn08cr177AqjGa571OAAEy4= Received: by mail-pj1-f52.google.com with SMTP id il18-20020a17090b165200b0023127b2d602so1443440pjb.2 for ; Mon, 20 Feb 2023 05:23:04 -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=AeeWLnjXmZb8t5JTf+jpvMzxuSa3RxnpJeCtpbomLHs=; b=UAzHFdBIo5C/b9jjrxbVgCYiJcb5+0idn//aJqZZYa9nARihqpt0V5S4h/WcydStTj PGndqy7WUpFcwUaDw1Gc2E3QjDe81sjHRBJy/WuebNrYUS1tArZ8mHfIcv4/uRmQm391 RegGeqjLqsR+G0r+A7HjLEVAsGSdIgpuV7ZNeUGtH06vcnixG7TVCmXZ0qu9CNxlaXO3 mMesvuW3UP1U8h+UYKiMqUDZ4iPlmtBoors2IKibGjz30KmXYT+I5t7rM4l2E+1jmbYQ f5K2vULGrK+d+7aiQ5+t34ddRBVxYQwn9n6JI3Mt6qxnmfrg7o5MXxYLY2jpGQsLAjqn m9/A== 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=AeeWLnjXmZb8t5JTf+jpvMzxuSa3RxnpJeCtpbomLHs=; b=a9rDZWDkGZWRhv8Yv3w9M3tcHmQ2oMMdaNtCavWyLkP19agcXISWSe/gc915a4R3KP lQ9hzrBPC7umbtMc7UQlBoVkvoRztk5jSny4ZhKxmjL2qKh852CImYMoA8GcT7KaC8IA U+3bikrorZH2xrjmmjpnaUl+5PmyvorhOTCYNPZx86wXJo67AfgZQrVeyu8P0DTMo5/7 51Pu+wNVO4GVutB56kdZbx23pffyyjl75GsBfDMOVqcTv1W6IWiUUCA/uGcBeF+HHuqq o19d25SiLYECUIWnpFv+oE+0aR1HbNSTkKwh9uSbvwMp6Xgjdg/f+bMGbWeG6A3bHo2W 4WRg== X-Gm-Message-State: AO0yUKW3SLcYlIEASpeBTAA+E85eXmvGQFkfpn77wA8f+OO9SAkdx2J8 k9+cUVCz0BGex+/Jd+gEwvA= X-Google-Smtp-Source: AK7set9Exj3SXDJeSIkboByuxtkSYeA7ku3EMv5TKuZICkHS0FVk0g07Pa40dPBJEgjRdzHaK/BO8w== X-Received: by 2002:a17:902:f98b:b0:19a:7900:dd8d with SMTP id ky11-20020a170902f98b00b0019a7900dd8dmr2038254plb.35.1676899383622; Mon, 20 Feb 2023 05:23:03 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:02 -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 11/25] mm/zsmalloc: convert init_zspage() to use zsdesc Date: Mon, 20 Feb 2023 13:22:04 +0000 Message-Id: <20230220132218.546369-12-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-Rspam-User: X-Rspamd-Queue-Id: C76C3100007 X-Rspamd-Server: rspam01 X-Stat-Signature: hbgbqpgo8db1a91xap1bys3umhnj6aao X-HE-Tag: 1676899384-704303 X-HE-Meta: U2FsdGVkX19GH+0M40MzIBCGwbOZBmC7J8fuVOR1KHUFte0fn74cjOpNxO47jH1Vj4v21ZS87e9q6O7tJaH+kchHx+YGBPU/TqhC73RrHxjWSC32wsNrUwjVgyyCGPdQwyOSMdBKusG80ckCnuUgtpbZprrGtZivshl9qgdrnLNQBAUvE3fz8v1IwPM2qUN0/gVu/Qcm4wHyT6LMObjJ1yMQxITUX2ULq47rDfdsRL8PVneEzSNYoe82m9C0NvkpfOxPe99NmOuPUNH44oZ6UB/4BPnsu3TURFpAdtGg4LJk6wWgc8ftwt88Q7JuWhRgZ+Hw3BIw97OzZjxIKsSfr80t1yiJC1h4cLXHeN1muDFg+6p7CIzLiV8zyPft1RmbqF1piDwiQrko7jb7/t6tM0WiysdSKmL33P6Fa2ZE0JnXSp5Nceaav24UWuCmqyH2QVonvY2clo5QAOQP1FpRgvLATlLJI64Z903bR85YBLq0MM3HPiTbUf7D+W+QO0iLV3CnJLNvdl7Wo70zrdco0D5HRrEVuWzzsKAFD5Q8p+3EjBBbQetWnABeGIK17ZVAN7bmYNkp6tH4J43B94XnYuemCntytsD3zuHhXqDaahmUJi1X/Gw93sZwjdCPyO3RlVJGLaG09OHIsGNacAI5yobC9bGDV1OB2Wgxag2Fy34DE3oLsWvr1X6o2Kfg0xC0gQtP9x2OETMPSq4JTA3lzQPAEzZd4chtrfu50E7XqddRCpkGk3VYH6inq5Y+04nx94v3G926Yqoww7Y5UKvDfh535KTbcQSBu6q50SsgxAQl8tdUXCUs3BYG2KQmMBLwZagnnmtLqgmiZkeTJaqOnQsiba7fgBfPqoVqjtlc8pInM5hpFyR8v5TsL6QC0o081PcF7dDby0NRobeOSgVIvyN/9YwAQEi4gjwfRM9Vf9c2JoFBQQqNzylTXmiHKPFPvyOQrJYOCynnXeziBBg qoqRceFW vcyPI6ylV6kMdcbype+Ur3fcdq7QmJ+HggVHNr8fsLVv+HT+3cl+khRU7sobSCks8qetdrLtHaa4nTgvHxOVfi+qUy3KVNpD+MYO2z1tmDKvLoi2E7t2oPIXA1/oJesQcuRnhsI4kfSo9gX3X/FKDdblPWFhO62SB0Xbwsz8goUX0l0qdWoUXy/nO3GIq+UT47rlWa2XRPiqMOZHv5bkGMnYU+9XWyzqSN37y/nS3/JJJyi1J+nmhzxUHhmIz7JNJNPiVQ9KtYxm0y/s5FWlGxnCLGbP2wAlPy2zg56SpvkJiBIekmSGSSDfkYFUukYm1FfCFP+FZfyUcIIL/2QBfrSeC4EHOqMbu+G0yiPWoYz5ihJE0VJLJUifba8ysEKe9F9cpmPvLO4p8vxX6c42oViATyNhHQ1yb/+0TIUDJHC9IFV573c+A2Lye/C1HATLF8SBEWRE7Hmes5xeZtzS5Xu5wG6lHPuDs1idFtf8DIivKmG9dYQuFC0XjtjasGfam1waQlLklPjETauG0HOQoKb+TQoENRP4pbjqQ3E4E/OMKUpJmGPq1O8bJcL5/OQHKvLzpt/EeIxivYGhorOnvbGZimV+oSUMBlibb 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: Convert init_zspage() to use zsdesc and update its comment accordingly. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index e1262c0a5ad4..cfcd63c50c36 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1206,16 +1206,16 @@ static void init_zspage(struct size_class *class, struct zspage *zspage) { unsigned int freeobj = 1; unsigned long off = 0; - struct page *page = get_first_page(zspage); + struct zsdesc *zsdesc = get_first_zsdesc(zspage); - while (page) { - struct page *next_page; + while (zsdesc) { + struct zsdesc *next_zsdesc; struct link_free *link; void *vaddr; - set_first_obj_offset(page, off); + set_first_obj_offset(zsdesc_page(zsdesc), off); - vaddr = kmap_atomic(page); + vaddr = zsdesc_kmap_atomic(zsdesc); link = (struct link_free *)vaddr + off / sizeof(*link); while ((off += class->size) < PAGE_SIZE) { @@ -1225,11 +1225,11 @@ static void init_zspage(struct size_class *class, struct zspage *zspage) /* * We now come to the last (full or partial) object on this - * page, which must point to the first object on the next - * page (if present) + * zsdesc, which must point to the first object on the next + * zsdesc (if present) */ - next_page = get_next_page(page); - if (next_page) { + next_zsdesc = get_next_zsdesc(zsdesc); + if (next_zsdesc) { link->next = freeobj++ << OBJ_TAG_BITS; } else { /* @@ -1239,7 +1239,7 @@ static void init_zspage(struct size_class *class, struct zspage *zspage) link->next = -1UL << OBJ_TAG_BITS; } kunmap_atomic(vaddr); - page = next_page; + zsdesc = next_zsdesc; off %= PAGE_SIZE; } From patchwork Mon Feb 20 13:22:05 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: 13146440 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 DD784C64EC4 for ; Mon, 20 Feb 2023 13:23:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7AF886B0083; Mon, 20 Feb 2023 08:23:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 760286B0085; Mon, 20 Feb 2023 08:23:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 600FC6B0087; Mon, 20 Feb 2023 08:23:09 -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 53C286B0083 for ; Mon, 20 Feb 2023 08:23:09 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 255DFA5955 for ; Mon, 20 Feb 2023 13:23:09 +0000 (UTC) X-FDA: 80487736098.22.C1D82C4 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by imf23.hostedemail.com (Postfix) with ESMTP id 5B5EE14001D for ; Mon, 20 Feb 2023 13:23:07 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=mmSODkO4; spf=pass (imf23.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.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=1676899387; 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=qwmkL2pzDsXM3Ihm2yCy21CwbNvNB3TX+HCzSAtLeMM=; b=PHdFsjkxaEdD9oTRaGcpj2xZzbP3Ms3wFWdwKZSqA91yGn+wh9ee3SaLfnR3pcHhdQknZD mCbJbes73YLXgYeoG1EIZ0bkpT7EJW9Qg9cGtD6gK99h5LjdJ2y0JzEAGdlh3irOGToYjK ky4+3/7wXyQtxOWuOebovF9gXOKSvoU= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=mmSODkO4; spf=pass (imf23.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.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=1676899387; a=rsa-sha256; cv=none; b=Gb1eAJ9Ftwgf6KeQUcxQ66pfk9xmyZaJsfgAQNpdJieTKObKshr+HOX9YpoDKqY0lJo1ok dPApspiQ2RC6QdVVkknzavJ98R4+5HSOutNjd7Q1umRpblOImf8yjNt8Wn7IZQpFhE0XCy Umhm2W67LCVsZQ4OcMHzdeP31T6Lo58= Received: by mail-pl1-f173.google.com with SMTP id bh1so1341014plb.11 for ; Mon, 20 Feb 2023 05:23:07 -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=qwmkL2pzDsXM3Ihm2yCy21CwbNvNB3TX+HCzSAtLeMM=; b=mmSODkO4nioadyk77ojoBU0SjJV2GwqPUB9uN/ss/8dhmkzE2wSuesClNfKEyQeAS3 JJKRQAswJSCe2QijPqCZb0AqqHUnrqG3+dQ+AIuJLWuKJSNeerGFx4p85tNfP99Y2wRX rO93kbE0FMiAGbDJSIKV0Iw2vW7AFvD6y7K1rTOhVyf6WCvTyH+1Z2NBiyKXI0QVjJF3 wemBd8AbAgZtmZLRqxmFU/TOw5DJCTSYC/wgQHKaqdVkA7OJgCQ/JyALGdGKEs5xtkX9 U5nQtEzIVIWEXQ1+0xWrV9yYn1bupdO0S6IWFlzVpv4SlM7vfo8beanAdLgDN+QkT3N4 7OBA== 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=qwmkL2pzDsXM3Ihm2yCy21CwbNvNB3TX+HCzSAtLeMM=; b=v1mNrCWLBvqI63LCwvkEm9A9rjm4rUNEiQ+QDwsx+Cdc+NculQ0vomLH7McO+7NZjc 40tTKgOzASZsTLgt9HU6d/FRJmXAfxXsyAjcNGiGOuyZl0jxBEKdw49kF6lL/exHWBqT WhFolJ2dXA6g/FT12d2d7XcNebQKx5mAFEHRbNTnG/GK8Q+RWnMamRHYJJ3uZIAdOk6x nnUY2GmYd76plU8MlWlfxOnKKXikx40zzqNDuqSDmpstH8oMvxWDNBh7+Y7R4v42C/P3 khuEkBMoV/fc8d0cUde0KDPFR9PwhJtVVoBiIMJ4ArZO3iIvA3jX/2KMTdd8FIQOi/oq JnPQ== X-Gm-Message-State: AO0yUKU7naPISomhS8fJmXq0VgIUjbOyiL3VxiyMjlB18grTmB1/5BjJ EgeroUzGAb8fbg3hHYVVtF0= X-Google-Smtp-Source: AK7set/IfL+H6TKNgpkeZFQVUrD9xP46FxPLwU/e08tgIlxgDjtVWawflPDn9xVJXPEK3Te8AJ8/TA== X-Received: by 2002:a17:902:da91:b0:19a:f02c:a05b with SMTP id j17-20020a170902da9100b0019af02ca05bmr1956504plx.3.1676899386249; Mon, 20 Feb 2023 05:23:06 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:05 -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 12/25] mm/zsmalloc: convert obj_to_page() and zs_free() to use zsdesc Date: Mon, 20 Feb 2023 13:22:05 +0000 Message-Id: <20230220132218.546369-13-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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 5B5EE14001D X-Rspam-User: X-Stat-Signature: oicb4n67gc3nrhbpmouh9x8kerixojnj X-HE-Tag: 1676899387-519184 X-HE-Meta: U2FsdGVkX1/ffQvEEuedIbw9qNt9crT/jVChLP8FJkBGaZ/pQQaJnhwGxg0BqaEW334qZyOwm8VGByuzEfJvL76wJfxOe4UfHMpYY4n77qGdCaPiaKN8lTvw7ztEHJj/PjeY7puo6RRbvyYBPM8awc09rWx+BPnM5T4S3m8LcG9hcz3324wRUAs4Izh2Blbg9eXB/YeJT492euBdP+a6zR2zIM80Rn7c1DVIavi6r/vmicyusc++1iMUoK/5uBKbHIzkB3TSyGR6K3lAb5vH6ao62FSODT4In8KIXyb4m5oQunXRIBqidvwuvODLPwQArTE8pp4HhFZryN0UYuTZbyy1s10N+sGOysrDltmUQknSEpbgMZAs2QaSKyCQ+JGF7lOIYhkeA8pClLUpcyaUsZBNUP1Nw/QqGXIf4UyGniEPGI4lT3kmSvs0XozVm9k5BiefeZ7LjbaOPDNXyP0iNdXbwNvJj1UTFl0g17uBLrA1PXnkivtxT3ydis1uWVTkw1E2GNS/wyqXq4117QPsp4xA9AclBrOmp33vuPLd6nfI9kFmrwwFan56dFNAsWoSamgJ8JF6gmjlSESiKZork0PXhu9uOWSe2pnftNbA7XSjwBebUgE32cYayTDCaaNqAwE4CImCJnGaRMQpwCbqnKk+MB6OIc6IlbKfkTEdQrnSslHvx3nOOdX+SIOkAQCRipMKNhlo4+W34mCdMigxLpx3pZI/Gt6/ZTBKZFAB801fCaJ4I2cGra2Hp8z/ykHIj+sE8UhiUvUWoVDCT4DAa5gM6qNb4hd3+1bhPuWZPZknMLYrPGMOqjOOMjfXkVFRVCgrC1fJ7b19xs4oexxyxWb/N19XnuI5RGEMFkLtGiSg8nBhWcJ2+qUAKyzSieSsYOpPooZSW1reren60TP6J22CSUooZkBGYvb6mk4TS/ELawb+7XycGfhCXCmenaBtXmVHaTcaqNkdYB+hWj0 Bn6ssTR5 NsvFe2WHtlcGb9nsGlSXwcFRfU11I+Cu6PEXc84oohwsx3enF87NcdEyc+2pbRfUJDhEWOvsIQYOiZVtoQ6ntb96ARyk+c3uSxULQKzZ0eieD6eKdPdsZrIysG5q9F9MQg2q6IC4u/e8Vtb03nIMdpA3gHSxu65abDeg1jk2otgT+3PJStXP30xYVLKXyndDwO4Vnh61O7v8d+kkR5SghTCbTpVUqq+CaBVrjbyG29YBqlWkA/8/7RPZ2R/JbzkX5cWHfvffUZvFoy1H7ZGhC5ra+TLKny7KDJa1oz0ZssL05ywKpEbVXVZ7S94pGBXC922RtMF/cev96DzJOj/L8q5bCW27A0ocxKOxRNKNBPjhmJmNDJ/mhi9BaaDH0jB5zPBvoLRqwAMASAlboMRxudUbTte7cRAVJS4nYwidnoGtLLznVi1oM70Kq45G9nlOYL88aZN8TH+EfL0JuVzhmQs0tqoD8r3rEuKZQpriPeIS0+d7AaJmuwjT/z8ctVJf9AZr6eEtV+JBhanxbai6axik3yE2owat8pAmDHOz0C9ZF7ttBv90flHelSP3D9I9CKctah/jbDYezhf7X4fNXlIBkVEND0BUhxSaajyzu7gldSoM= 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: Convert obj_to_page() to obj_to_zsdesc() and also convert its user zs_free() to use zsdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index cfcd63c50c36..bbb65fb8749a 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1020,10 +1020,10 @@ static void obj_to_location(unsigned long obj, struct zsdesc **zsdesc, *obj_idx = (obj & OBJ_INDEX_MASK); } -static void obj_to_page(unsigned long obj, struct page **page) +static void obj_to_zsdesc(unsigned long obj, struct zsdesc **zsdesc) { obj >>= OBJ_TAG_BITS; - *page = pfn_to_page(obj >> OBJ_INDEX_BITS); + *zsdesc = pfn_zsdesc(obj >> OBJ_INDEX_BITS); } /** @@ -1787,7 +1787,7 @@ static void obj_free(int class_size, unsigned long obj, unsigned long *handle) void zs_free(struct zs_pool *pool, unsigned long handle) { struct zspage *zspage; - struct page *f_page; + struct zsdesc *f_zsdesc; unsigned long obj; struct size_class *class; enum fullness_group fullness; @@ -1801,8 +1801,8 @@ void zs_free(struct zs_pool *pool, unsigned long handle) */ spin_lock(&pool->lock); obj = handle_to_obj(handle); - obj_to_page(obj, &f_page); - zspage = get_zspage(f_page); + obj_to_zsdesc(obj, &f_zsdesc); + zspage = get_zspage(zsdesc_page(f_zsdesc)); class = zspage_class(pool, zspage); class_stat_dec(class, OBJ_USED, 1); 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+PFoYZQi/BnQo1DfKioCvCbr2HnmeLdv3Z83nPYoBPd35lQS2r4mYu1uotqN+u5UokzGhu89CI7XGFJovPpcuUpfBAK5Ki5bAuKDj5jj964FnijnoD1erKBCozC1ZM1BjgL0bA/TpKaQBAQjxAus53o08gA+pgl9s36g9tXh4CP3/JN7pQ6OAg1Lscm2E8Md6f59qubYhd7+A1Oso5l4PZ9L6RYAQmkbNkJD61mdSAN1lxQ9w2pXAm7J3QommW5xpQRXzBlW/YXHhISP4QLbXsBV9QZSZyngBBjkeIwCOgbsI5MvnIH+H24S44wCXZQp4QEkELIJiOixZahaTPGvm4R2e/T/4351URftY6eSKb7Jo1h6+fqetQo46sjrSCk3yN7Pf+sn9XT7SIud9oHXi03PmXgEPDSRdOvBGvoNN3yUa02R285opC9OA5RRzMHnnH510mlnDwnBB6yE7qP/8Mp6N+powPamLyOsI0+yvNHuPJiK1M9jTyKpnZ0NWCcY/w6vONxlUaVkwjHV/L6zF4MXsRpZSi9StExxavFn9+RChZDqJXIzkSJ0lqXa/joQbU67EFq9zm4XpYFGjB2R8eF1Txci3MkUiXrC6+U3 a/yaawMl HmCdgtszT/cyi3taX+4f1bRRlF7y5d/Pb/aqOxYZh37IAppQkQBCTrsJNhTgxgS+72gpZdHoxs0KI4ouhJrde0jjwQykRAjZGH+kf7hEYKJRALcZvfrcZM4ecRSICOJ6BI2JiR6u/hLRDOpfa7rwUze7gYdJOMlj4HM3pNPI+4LY8bd4xMBk7bEn0j0kbAWahq0gZlgZ/GRcZTsVv4ZzNOYz1u3XlkwDxdqxnCmw5CzNZ/xcc6S8NkUl5BzGcMp97SYiHl5VpligIILfyKccBycVEM0PmgvQSvhA4yOgVd4hBZRAAfQFIOJXIdVlRje+GJmik0QjqIdyS4D5VFKfNDT53qwwHPoAebN2J2yFCYFsaZGn61Cqt4BW7bhTkSSdDDDOnPGTe5ss1DotPjnQwKwQlIPo3GafUe6ZbhWSaGZ27hUYAyH/wAC628BZJs0SNWomtxvdEyhmDHqVkhwUjM76vyMRAoVB2/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; From patchwork Mon Feb 20 13:22:07 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: 13146442 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 B5EF2C636CC for ; Mon, 20 Feb 2023 13:23:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 565BA6B0087; Mon, 20 Feb 2023 08:23:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 517726B0088; Mon, 20 Feb 2023 08:23:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B72E6B0089; Mon, 20 Feb 2023 08:23:14 -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 2D3816B0087 for ; Mon, 20 Feb 2023 08:23:14 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 075A21603F8 for ; Mon, 20 Feb 2023 13:23:14 +0000 (UTC) X-FDA: 80487736308.09.F50F6DD Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by imf23.hostedemail.com (Postfix) with ESMTP id 37540140015 for ; Mon, 20 Feb 2023 13:23:12 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="FTYnX/Wr"; spf=pass (imf23.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.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=1676899392; 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=EsO1dtiPmIqk89+L0PC/QY+hoYO9HQ5kr0OEemlC8x0=; b=jf+joEqmqbzsGlWVFbv2d+W5j/elIRYGFhLxu2OBdpNFyyfd2evWnZrxCOADgpz0AQdtVs BgMpeAqYZm0r7ZklImeHo2ND7IDTzNMQU0WdWJqUZFMfUYXdCr3xSaTytRFfWi8HUWT/N5 KfG79Wgh/N9wZDGE3Otbl2IVEUeg2KA= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="FTYnX/Wr"; spf=pass (imf23.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.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=1676899392; a=rsa-sha256; cv=none; b=btQqwl4T44Hup4GAhqFYEvcoMrsgCLdYmtjwR9sSenkTWdoIx2Tqu7JuFHRP41FPu/wpow uMq5Ya34htT7NtGAsoDgpCdkt6jh5inG/rkw5Eu6jWGcZ47yWn+ZSlVKoPl3tTSdNL0cXw tx0PKEfuPr8iK/h0haArhogOcWQjjX0= Received: by mail-pl1-f173.google.com with SMTP id bh1so1341363plb.11 for ; Mon, 20 Feb 2023 05:23:12 -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=EsO1dtiPmIqk89+L0PC/QY+hoYO9HQ5kr0OEemlC8x0=; b=FTYnX/WrBP2C7Al3tx/fyF9LK3NZE927AGA1l/PFkr6pDPPMdOy0IGL0z9c5nJTu8p DvW+1j4qxtpDhjTzPIVYcBO5fKG5jnLhAFIpbLlPlo9TLlD+yF2XU6hqx/kgXeu5Thb8 fOMEOkv8TDftL/MN29fPMOGnx3hYJpX06isEcNCqBApslt2fz2XY0U7Y+cQqGLb7U7gh 0C+tSU5BvTr+kpGIDd6/YBMFVr1JTjh0gzD/VIV+hb0iBcav/xCr+fIwtSpIcfxbDDZ2 wBdST9GUGDtz7bGSrvGY2ET+4xqTFuSZ3SVT7CkXogv/RahCt1Ch4Blmz+YPvq2FOvjZ zBTg== 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=EsO1dtiPmIqk89+L0PC/QY+hoYO9HQ5kr0OEemlC8x0=; b=Fa46aqkIOt52wrZj/5Ceh1WWN1VK3+HLusFcF8BQ0m9AsCXyx+KzY/6wnWyl9JNWHO PSHykj0xD1YWtGduUaHucSAbpeXtTdjdAVNtofHugpT8XAYswkFVQWR+39gxemXcWLTK g/JqyA5C8P4OUAtIia08pqaIvdPOphAJRR1yXHkYa0Sb2kNFAUHtRjmy78aZSOmPVD+m QmoZRR8w4Crz8XnMuzivHx+RkN0NHvLfSRjpQI2pZ+lt3fl7seX4t/bIRRoqN9tAOd9V 0mt+zkvaNEomyh6qPUUXFu02QcSLJJ3JBrYEJVswCsSMjJ/VLAWiFukY0wbp4E/zduIh injQ== X-Gm-Message-State: AO0yUKUHmAQrWppatX+XxKb5wYNKNgfz/sYnjHQXSZSRz9VyReqB88Aa cQ25RoZjvwLDy9vygDBbeaKuXX3JKOyCWA== X-Google-Smtp-Source: AK7set+1cSNyKxU0IijJuq2QUw9fX3DUb+UXhA4usFhzh4AKREjeecXa38GbX4nwRe426gaAdT6ONQ== X-Received: by 2002:a17:902:db03:b0:19a:96a0:4af5 with SMTP id m3-20020a170902db0300b0019a96a04af5mr1412304plx.57.1676899391660; Mon, 20 Feb 2023 05:23:11 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:10 -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 14/25] mm/zsmalloc: convert zs_page_{isolate,migrate,putback} to use zsdesc Date: Mon, 20 Feb 2023 13:22:07 +0000 Message-Id: <20230220132218.546369-15-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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 37540140015 X-Rspam-User: X-Stat-Signature: kt5rze7bge6r1nb55zjjnoacegnoy4zx X-HE-Tag: 1676899392-817301 X-HE-Meta: U2FsdGVkX186bc7pokZeZ/4RQEZI6DpBhS5VZvtn2c/YCweGGkyIbYYslVA19u34/Wg5gx/nF6GRXNyNI+xWHFNSQAiIm9+Wf8Flw84/ccB3exvQRQZf5mBvICcPvhh6Wf4mQnGjTm0r2OFslnrnkYf+eQ2yItsyvJH0Xsm93NI82Pu1KUuvIzKMNZbu06AzOu5N2czDDsAeG6OFef4e5o+LyYBBO/yzpQsyxaOIsvFQlNVh3I8GJzzqcfkpnoBZuO29pHEwcatoJYt5Q6IrMveHlen3XUCpu5aCap/ukP1nWbQ6ADWUdiby0FT5LuFc8ZDMNVnNfey8kb33qLvulZ+qp8whrs/c3qMsl033iy12yxkrCSWjLtmCLRzjXBoP6dfrAi3GH2EQqPxeZ7SxkQqfzdWUkHvXbmkWMQB/y7vM9rIQPDylIBBxmpQXNe6WhEH5RYdY9k5OUqWyvMo29AlkogV6Hrbdfqp5tHvKD0nY55f8bEAjHBS8DPsmF0MO0Qyat4w17vWRI9Ae+y8d2onowHmFofgLS4mt5RTGPIyG9quMPolDXObqPl7lIU9rxcAWloFUu26VGNCsyOEzUGUO9CGwvFkfFqU6lZYzzu7fVokCotD/ebuLVsXYxcQuHKW/Wb1GobRjKBeB5JxWGeGwWh7pw4/YFaOL+QJVjYIimYPc27Bhi+YbbcKg0+rlC1ClRWp0EllxQeysiurwNGLxJQyheAUAi4cHWiC6AWx5gomvq7+qWjjmtfTmCTfeLqm+sZp7O5pvJ/WvhSn3GkaIXTMMAVvt1+V82jxsRwZ9tfQmhKN2CuV/XtKA4lTvTBpfG7VgfRyNp7WzrLsx+l00EixqxmxbXXdLU9vDmXb6y7F4vKBTmQDnUqpqB4x6xaOS2q+IS/eQfnXb7HyfeXm3cm7UbEDmgejgdCLVvUapS6xswJ8qDn0zf1bEaI1ZTWonNhWwjoi+f+yuZJL tnuHq9NB t6sRT9arH2PZb4Od66+xTsgVEEm7B740nim+1fDCw4qt94qrrYo4lxojskewxFiz55afY6sPdyEB99kELjY+ez3KPXtvwnPQyUMfaft5UtnKiUeXsD1OItjFaputwGKwMj/fWIn+o4uiy66zBtiAcybU4/npswLr5VtdgFJLleYZNVxNHWqVPv9ly7YTbFU2Sb67WF43eQU9xV0NO4c11rRYv9Cqi0Y8M3G+/3qG8GRsGi6Ce6EppNp4uF5YB6Ou/CkfBsuTkbFbgv8tQ2ueiUuGQJwGrUQlRmAFfcRNgasp5M1L4Et9Fzav1rgfysfhiUk6Ujmhq5siRE6Aiv5CWXNurzimmxp/62vRhPVoHucLV7JLufZkuR2jrN35bJ5Ea/lwag/vmxJ250vVawa2JZ/TSNjRM97ceh0mQLVKvJlQD3N3V6SozuA/OYwN9W7mkJB/L33BR99kQBRRKixEXrMw3x6EiJ2ODLRW1vdmirrvqiuinl5zFwtbtujCg4ai6Wx6H6QkDxPHK+lXDZaHq0juVQUfQrTsd5gAB/+c2KgU8VTaX8niDJY3KTNZP0FoyLpM4UQp5PT2clV+F+DPgj6UKQNVSytchswOX5J43/3BNMS8= 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: Convert the functions for movable operations of zsmalloc to use zsdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 5a3948cbe06f..ced7f144b884 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -2181,14 +2181,15 @@ static void replace_sub_zsdesc(struct size_class *class, struct zspage *zspage, static bool zs_page_isolate(struct page *page, isolate_mode_t mode) { struct zspage *zspage; + struct zsdesc *zsdesc = page_zsdesc(page); /* * Page is locked so zspage couldn't be destroyed. For detail, look at * lock_zspage in free_zspage. */ - VM_BUG_ON_PAGE(PageIsolated(page), page); + VM_BUG_ON_PAGE(zsdesc_is_isolated(zsdesc), zsdesc_page(zsdesc)); - zspage = get_zspage(page); + zspage = get_zspage(zsdesc_page(zsdesc)); migrate_write_lock(zspage); inc_zspage_isolation(zspage); migrate_write_unlock(zspage); @@ -2203,6 +2204,8 @@ static int zs_page_migrate(struct page *newpage, struct page *page, struct size_class *class; struct zspage *zspage; struct zsdesc *dummy; + struct zsdesc *new_zsdesc = page_zsdesc(newpage); + struct zsdesc *zsdesc = page_zsdesc(page); void *s_addr, *d_addr, *addr; unsigned int offset; unsigned long handle; @@ -2217,10 +2220,10 @@ static int zs_page_migrate(struct page *newpage, struct page *page, if (mode == MIGRATE_SYNC_NO_COPY) return -EINVAL; - VM_BUG_ON_PAGE(!PageIsolated(page), page); + VM_BUG_ON_PAGE(!zsdesc_is_isolated(zsdesc), zsdesc_page(zsdesc)); /* The page is locked, so this pointer must remain valid */ - zspage = get_zspage(page); + zspage = get_zspage(zsdesc_page(zsdesc)); pool = zspage->pool; /* @@ -2233,30 +2236,30 @@ static int zs_page_migrate(struct page *newpage, struct page *page, /* the migrate_write_lock protects zpage access via zs_map_object */ migrate_write_lock(zspage); - offset = get_first_obj_offset(page); - s_addr = kmap_atomic(page); + offset = get_first_obj_offset(zsdesc_page(zsdesc)); + s_addr = zsdesc_kmap_atomic(zsdesc); /* * Here, any user cannot access all objects in the zspage so let's move. */ - d_addr = kmap_atomic(newpage); + d_addr = zsdesc_kmap_atomic(new_zsdesc); memcpy(d_addr, s_addr, PAGE_SIZE); kunmap_atomic(d_addr); for (addr = s_addr + offset; addr < s_addr + PAGE_SIZE; addr += class->size) { - if (obj_allocated(page_zsdesc(page), addr, &handle)) { + if (obj_allocated(zsdesc, addr, &handle)) { old_obj = handle_to_obj(handle); obj_to_location(old_obj, &dummy, &obj_idx); - new_obj = (unsigned long)location_to_obj(newpage, + new_obj = (unsigned long)location_to_obj(zsdesc_page(new_zsdesc), obj_idx); record_obj(handle, new_obj); } } kunmap_atomic(s_addr); - replace_sub_zsdesc(class, zspage, page_zsdesc(newpage), page_zsdesc(page)); + replace_sub_zsdesc(class, zspage, new_zsdesc, zsdesc); /* * Since we complete the data copy and set up new zspage structure, * it's okay to release the pool's lock. @@ -2265,14 +2268,14 @@ static int zs_page_migrate(struct page *newpage, struct page *page, dec_zspage_isolation(zspage); migrate_write_unlock(zspage); - get_page(newpage); - if (page_zone(newpage) != page_zone(page)) { - dec_zone_page_state(page, NR_ZSPAGES); - inc_zone_page_state(newpage, NR_ZSPAGES); + zsdesc_get(new_zsdesc); + if (zsdesc_zone(new_zsdesc) != zsdesc_zone(zsdesc)) { + zsdesc_dec_zone_page_state(zsdesc); + zsdesc_inc_zone_page_state(new_zsdesc); } - reset_zsdesc(page_zsdesc(page)); - put_page(page); + reset_zsdesc(zsdesc); + zsdesc_put(zsdesc); return MIGRATEPAGE_SUCCESS; } @@ -2280,10 +2283,11 @@ static int zs_page_migrate(struct page *newpage, struct page *page, static void zs_page_putback(struct page *page) { struct zspage *zspage; + struct zsdesc *zsdesc = page_zsdesc(page); - VM_BUG_ON_PAGE(!PageIsolated(page), page); + VM_BUG_ON_PAGE(!zsdesc_is_isolated(zsdesc), zsdesc_page(zsdesc)); - zspage = get_zspage(page); + zspage = get_zspage(zsdesc_page(zsdesc)); migrate_write_lock(zspage); dec_zspage_isolation(zspage); migrate_write_unlock(zspage); From patchwork Mon Feb 20 13:22:08 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: 13146443 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 606FBC05027 for ; Mon, 20 Feb 2023 13:23:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 035C46B0088; Mon, 20 Feb 2023 08:23:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F284C6B0089; Mon, 20 Feb 2023 08:23:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF2256B008A; Mon, 20 Feb 2023 08:23:16 -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 D02BF6B0088 for ; Mon, 20 Feb 2023 08:23:16 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A5875A2821 for ; Mon, 20 Feb 2023 13:23:16 +0000 (UTC) X-FDA: 80487736392.17.D443CA0 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf06.hostedemail.com (Postfix) with ESMTP id D83D918000D for ; Mon, 20 Feb 2023 13:23:14 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=eWZwVmzd; 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=1676899394; 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=kWZBaCBY7/lyMA0ZpKm/ZUcumuceWXxJ6yxCXnHQeas=; b=wK75bp+HbjRZsSqOzQ7A5YkqgTrTzr5kB/giMtI6OOVLgonsqBhTulBuGwSYCDTkZWWnCK u+87+1NMmkiAmQGG0EZnlwPxmiAv9MvNcfXWGEjKxcwVc/p/J/QFKTYv8R33sTUqo/S8n/ eEIRy7RnWZ8yhozx6yONjR2RrnLZYU4= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=eWZwVmzd; 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=1676899394; a=rsa-sha256; cv=none; b=DFdPpU9jMWDXZDXCc3ueCaA4zCRI3fsWhce3YPDMyOrVlHKgopivKXib76FRNnGCtsVhOn hJGnqBRKs7jdMp/JagnGqKeB7v0FaIQIRqz4vPQ28esx/lFgb6JMkfi16dpGYoAWef96me Fq0mcgnMOCuxP5g9Rz48xVTh/HuTDBA= Received: by mail-pj1-f51.google.com with SMTP id f9-20020a17090a9b0900b00236679bc70cso1996987pjp.4 for ; Mon, 20 Feb 2023 05:23:14 -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=kWZBaCBY7/lyMA0ZpKm/ZUcumuceWXxJ6yxCXnHQeas=; b=eWZwVmzdBtx29OPYkhcCaTBmF8xvpeo324aQIy1yrjzla3Rjrau6cCgKcBTNdsac2J dcJ41ttYXeiDJsbUwCyj/PFlpGcbEJkJlc1cLfbkAHcQWBBWU08V5ibWc4h787dU3Nbq 66aGcCLSQmq48LV3zgJJ97agPaSb+l1bPQnbuguvI58kJWsxpGhRVKm4Xs/ZJjkUaaed HDVsy7n88tM1fCo+blhsoCrLF2q+8TQbLBSefe8MmdpZpS64yO2D7iHLbu952TsMU0KK Nt2h8IjLYfre01RlxDe8+4uJw8HeBBsdUrRQdHHg8EjUJaz84XIGDjrAXmmXrt3kmgi7 IJYg== 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=kWZBaCBY7/lyMA0ZpKm/ZUcumuceWXxJ6yxCXnHQeas=; b=rj3XaF7VtX1uLY5w46rjuH95/p94G1637+nijI/aCNM4e/MeGNza96yHpQwv6YlEgH 1Bd0cle0f7r7qzYxaBpvzOh0DE3CKzXQuhLTEOSmjkm1zxEPwvdGkXBHIbL8Xb7eed9Y Us6G7rfxemX6xrNhwUDEel+OWPd6EIQbv66M5ZGTA5FVv8TgZz8HrTIGW7h0jOIFqQJl hRshH3A7wV9tv73bcbc6FZdvJMwaNn48SpEoLoat+qhxP7oS1jfPed9DwIeNguhQdUpc oetiwyw41d3ZkpiNJqqF1Mgn5cxVnZkUCCgeHKRkG9XRc/wYDXr9ZQ9aTb/9kuYKlWUP IvLQ== X-Gm-Message-State: AO0yUKXxc0hH+FIFHPMOp1Sk9vaClzYye7HJZai0zWEgu0xF7DKXqND7 Zzm1229V1Gm+1pEALeIMYICVr+e7r5o7xQ== X-Google-Smtp-Source: AK7set+eK6eHfyxZbKLPgP0633S6/Mvq1EDoug3kacaFpBhr4X4tfoZG+YbM4FyAcowPsEPWLN9Rlg== X-Received: by 2002:a17:902:cec8:b0:198:adc4:229d with SMTP id d8-20020a170902cec800b00198adc4229dmr3466642plg.24.1676899394329; Mon, 20 Feb 2023 05:23:14 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:13 -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 15/25] mm/zsmalloc: convert __free_zspage() to use zsdesc Date: Mon, 20 Feb 2023 13:22:08 +0000 Message-Id: <20230220132218.546369-16-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: opesi77py6jdq6b5nfq169kdnes4t9dr X-Rspam-User: X-Rspamd-Queue-Id: D83D918000D X-Rspamd-Server: rspam06 X-HE-Tag: 1676899394-813493 X-HE-Meta: U2FsdGVkX18IGbF2uQG3vZQppgMgwt8FPQsoLClQC5oCND2e5ERzfuI+AOPZodsn8C1ErWCC8hb5IpwAQafKDyJzPUnqtStfUAXRQmatMCOut6QAJQBZdkZrbOR9EdKai+AorzkjhA4q53EyOPFl5LpBK9DOQnEQI4pwA4jm2tA3IkNcl8fVSsBzdBtSR7hB5gq+G+hihngoo3/9hLOyWvZfhRrDYGd7753lpYBrnHVMC108xlxBdyayZtcyTms4A780jO9DFDloQXWY8oWvrvPLS2zk38oXOKhjVo6dkhiTisCI1Y9Acioj5Et24iPYC4klHV+phgt0b3REnG9lV0qqr+JOCoUqNsp+NjHWYeAQel5LwxMzvTJi+QCvUVg91YGu7sWc+8/YH0B94GFUZZrj1iib8xEXWBLOhEgtIUEZ8GPbJ3ru5G4Xc+TNzmp5h0pP9T6fZEI1Eo1UWPht2hSt7U7fgEXCD8f0pm1JHV0gD14fnwIsTnPyyWpRdnkkOU0WXqmHJd4nOCvUAuy2tes1iHkiP3wqXj8qhJGop95V2yMNfGN9rghnVAU+6m+OeozMUOXC9Hs4S4oGlfM5zQ3aqPU/pr0ptf5aBbcEwkBBWeCGWBO9jT4MD0ASerRQr3ck+9FQ1t8rjw7k7JVinIIDusZ5tf5EXBygNZargh7UHWLqXimJUUzjyLLBCLQbDamOVA32Fixbcz1eCCbDR5xT27YKvduD8UfdIPLrqs+4nwK6vZnELC4cnwQFdm4Ak8XhHzidLDsu/Ls2UxBQ9UxzwJ7u/eRJ8QAEBRoTdZkogw9RU85BeIJH4an6abMPQ98md6JNROIlzXp67/N7OW9clW3Acr2G6Vp5doCJFB3lrKij8WZGX2kP7wOJRcInlobdnd6QWEA9wJBbetLc2GBYNXLZpzHSFuYNlLeEsJ153PIvrvLc6xWYtOFv21PmgXoRmTNhINJtwbnENwv KSaZDWeq ZVsb7wCIRQvtiFq4joPWlklenpWfSTt/9caomqe+ACN9x1yklTFRQCAS5IruMOQI8R0uzWAAVK2cGZ1QJEOWQVJ9wVTee5joNuqCvNs/a9/dI9vK9MtFrBwSE5IlAbgTEBKjy97Jw92H04wbxeYPuaolCuFYu1ABRPM2q+Sl0aybe91WfUhG6ISAj/V2t0asdMVLmFQ02Q0BRIz6fqiU2/HfSIvRG2ESQxt+J36yi6tfTbL4CS3zKytNYbOw+dPHPNucl9JRCjYZSTpiwKj8JjY6qB6jzPXKPp87aLWjpxrpsipya4WtXHMpGgglzXoyKTOTn3wWH5JRRH3STmHNuZvpKYhVs8/ENTrOc2DDbBx7dvue8ReNUCHGSw2iz2Ac2yqU5yu4n+1Fg2Tg6DDwSV6UXoxcsLreYqLGJ1V6ykn9wf/YeKyU7UbGyU/zXSzqroO4/+FwXUAGMLJ5/9Rb7t8AfSAoWzP7RlGTgf3T66EnV8QRNW4gZFzS32DbBKw7DpPF8FaDcIO6scdCGZ+u6tRwvGF2O03g7jhiJlnBRVl7WvdH8F0e1MZk3KvayuN7nqLV6wgCC4oAIXeAMYoT7zLHeHwmD7TQjm82f 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: Convert __free_zspage() to use zsdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index ced7f144b884..7ec616ec5cf5 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1148,7 +1148,7 @@ static inline void free_handles(struct zs_pool *pool, struct size_class *class, static void __free_zspage(struct zs_pool *pool, struct size_class *class, struct zspage *zspage) { - struct page *page, *next; + struct zsdesc *zsdesc, *next; enum fullness_group fg; unsigned int class_idx; @@ -1162,16 +1162,16 @@ static void __free_zspage(struct zs_pool *pool, struct size_class *class, /* Free all deferred handles from zs_free */ free_handles(pool, class, zspage); - next = page = get_first_page(zspage); + next = zsdesc = get_first_zsdesc(zspage); do { - VM_BUG_ON_PAGE(!PageLocked(page), page); - next = get_next_page(page); - reset_zsdesc(page_zsdesc(page)); - unlock_page(page); - dec_zone_page_state(page, NR_ZSPAGES); - put_page(page); - page = next; - } while (page != NULL); + VM_BUG_ON_PAGE(!zsdesc_is_locked(zsdesc), zsdesc_page(zsdesc)); + next = get_next_zsdesc(zsdesc); + reset_zsdesc(zsdesc); + unlock_zsdesc(zsdesc); + zsdesc_dec_zone_page_state(zsdesc); + zsdesc_put(zsdesc); + zsdesc = next; + } while (zsdesc != NULL); cache_free_zspage(pool, zspage); From patchwork Mon Feb 20 13:22:09 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: 13146444 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 9A035C636CC for ; Mon, 20 Feb 2023 13:23:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 391216B0082; Mon, 20 Feb 2023 08:23:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3416A6B0089; Mon, 20 Feb 2023 08:23:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BB2C6B008A; Mon, 20 Feb 2023 08:23:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 099D06B0082 for ; Mon, 20 Feb 2023 08:23:20 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id E407DC04F4 for ; Mon, 20 Feb 2023 13:23:19 +0000 (UTC) X-FDA: 80487736518.20.DDE6D85 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf05.hostedemail.com (Postfix) with ESMTP id 056D2100011 for ; Mon, 20 Feb 2023 13:23:17 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LWGPMCpG; spf=pass (imf05.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.170 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=1676899398; 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=3X07HaKD4mK4LI0LVz1OQSpeGzc08+5+dCVdgMAeBqo=; b=eZB94l32MQzZGw7sG6jjLlWqGDY+11+xVkJ5c6hB8p6znmT89onzyb8DHYTnAU4/lu62gC vY1exnYTVjSHNaCwPD8q0J0vv0BXYPKxqZLHMWJPh1FaDsRbxaXK0frJYkFiwq6g2FncQ1 +soca19OOqwFFoRNLrkZuGjwA0+dHzc= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LWGPMCpG; spf=pass (imf05.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.170 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=1676899398; a=rsa-sha256; cv=none; b=wjP8EhEATzTamAkzTWeSreKm+f53w/bzxQ0lkmaTmMJOp7FYMAhL2VLvhIKwzgoS7LGtwn grwa5mTpbmFF9V8EBvINhoB7kBKcLJHpdSXbbP1UBUw0gPVGdlZRy2mqEDr9wI9Ztxiu8i f2CTLeNAEG8sTZsENiNK43Yqw17Q86o= Received: by mail-pl1-f170.google.com with SMTP id e5so2396681plg.8 for ; Mon, 20 Feb 2023 05:23:17 -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=3X07HaKD4mK4LI0LVz1OQSpeGzc08+5+dCVdgMAeBqo=; b=LWGPMCpGnq+UBUJwyekuEOvp6W3g7bYRagaJdiQa0/97Mgb84x7+QtJnfQUXXdpeb5 PFjPrNIKwJAx4fMEjS0woDaby0DbWy8zmPaV6a30pBmNHwsmHRPBh37J3SeIknlw/aom iBtVVOpob+CqJCJcyCZLsLUbHvcMTmvtHY5/lp28mrrdkRP//5DIlqjl0y75uwTeCOkP aTMnWITV+5GZuj1n8PUTqL9jE2MVRgOJeS1I1PEiGtjwGjWXSrYGAI1/7Qgq3wm+roNj MAGdkQbxd+QTfZ8aw91KnxZwHpMM9ixkRPUIt4fA3QygquMyQJH7EazIQSlKcuuWhReG BzMw== 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=3X07HaKD4mK4LI0LVz1OQSpeGzc08+5+dCVdgMAeBqo=; b=Ys9+aJ16Cy8L72/isix0pTuZ1SAgg4vJnABCrXs7W1AjK9BFe8NW34Vp5DuKsX6EC5 g2+jsXxW/OMYo6Q7ZD/Uuq80cvStVOI1dNRiezgZ3rQk6lX1eY5b8g3/KWeAvtdgl9lq VtJqE9kRmULi+dnvZhw0Qsj3aGPXl33wYD20Z0CHelIZ1ONWxOKFuTjrlIOAyVrpQiWe 3Z5+cImQl/cYRRuoZLCzbM0PVprEEOBLrRg/9wKfQt+mlgdM1+MZok1bCprKs6PPL1TU UtOz/68V7+9aqiYSwJR9qOxMjzAv0d0aFk9QPDnwZOBWmkzp26R/g7A2YTPc3rxbWhUD 8tsA== X-Gm-Message-State: AO0yUKUWLqUnsVXl7PYB5brDsMh2x4Tebbz1b9wTdhcPRnTwZmP5pDMa /2QUXTYUDPLeggnxzHsahQU= X-Google-Smtp-Source: AK7set90E5/KAMP/cDZSrwD1MZ0t4Wiz/UE+M3KlafYgqdJ7ZmMpsmG38GZgYUx77u2p3rTnb9Vssg== X-Received: by 2002:a17:903:187:b0:19a:9984:5562 with SMTP id z7-20020a170903018700b0019a99845562mr1374581plg.33.1676899396953; Mon, 20 Feb 2023 05:23:16 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:16 -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 16/25] mm/zsmalloc: convert unlock_zspage() to use zsdesc Date: Mon, 20 Feb 2023 13:22:09 +0000 Message-Id: <20230220132218.546369-17-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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 056D2100011 X-Rspam-User: X-Stat-Signature: yxeq7uiim8tdyzb51ff7t59jndmg3ckq X-HE-Tag: 1676899397-606782 X-HE-Meta: U2FsdGVkX18CVEEZEGZHjMzaWSqc6LOgsOC6uKNLu9kRb47B3HEfYZp67Fk0A6Sho3/YLflGKFBaFtWR2yfImx08qsdJcNhgFZVEEKZHup++F9fPPuIcUpvrTJhwbyoUaSM1qaUFWjIDar1z6FX+dOL0bzJ93bdhyTP77cjwfO6iQO/E6b+gux5RxrVYb6+4mjQXVZzZTtm4oQx1rOMtcxJ/K8dhgQlEmksiRXcrbqY6az0o67rJ4qTI19i0hZyR3S9ooWC0rGdCKT0Gf8ZcAC5SqqEPE7wyqLVeDPPHz5E+4x0zBZ2sbLm5b0vzc4YmvVOVCiOV9dAKZjFjceYDLgAB57d1bCJVpue09NBuenTa4QF4wxofnXJxiFYvwPm1v8kaHK+swX0ifrO5ZNWyEVvmTHUGO9utOAT6ZsH9S64VioWvlmBim2auKZSVsJk2WDqnwicFaBszAt2A8tiNld+1dt8FIqehThqUS8DkpdZAWx/Nct+wCfyAdNBScH58/KiB5E9Tl0CzcvkUp5AStQ76G0mCcGCcniZG6nvsWDCeJn56wtkdrkwV6/q/ULEVTqab5anwqUoScWKfu78iEsVl4HL4HmKi5ZACOJkvx/Im4vllktYN/YdsPXY+bfbgAuT+ObcRCW4QgG/NTFM2/lPNRhbiXJlLVSTUDu69HoFyYlfTNGHBqZsOc55CG9hhLa1NMNP8hh8l9J55rNPniEEML+Pp5B9WsUtGre+ytb04JnHUAstir8tiKVat2QrX2w71w1Olf+ZcR7pq0wQ0Xl/1JGwa7V1mDM8GihVZ4mYI6AuLgzpD/ykHLHGHiSKohpeX6O+wXqm4E/se4cJ2hENB63Jhl+ECvYlESBrKh8mwAn0Zc5zxUgO+/TVWjQZN01CHmlUPcKaTtAig7HqC24rZZgZF5WZ/Xf5nDs1sLqrWUm79ijIxeduQq59o9FeErOyzcdFy8sddFVFMuXn QX58T5PH KPeTfA1eTzYqt2Y1NPFNVtWC/V49Tgwd+sozvHFY5b85f4jbgUs1SE/tqPMMZ5sDIhy6Sr27ISjBYWRx1tN7bhIvD86yl+YXwU01aE92P7pMv6Oa9VlR1AQSP3ue4HM2tRsp0eRo+93WNKQ9wLjIFPRfFR49v30+y+D29gckIGuG5sXG/cnS1ndkgkv+jYS3zKe7En/ak3JtoGHMKrYa5dM4IfzaLMRAmfqGmYfz28HFFxy8+eNNSbMCC8bo/zS2iTQ3ekHETyy6xIS55MjpYxo3F2f6siiroxCfyzRkTl2Wlrnb2NTaZzMI3bwtwYn6SczMlE8tXXdZwDybaxRDDMVEAbz5YxPIBBVOVKh6rDlfe6lAnLsMJrCtCMGYF2WxIVZBHWUWvxfleFG7sLap89HFRFDHvgz6nT5SjEvghWTSoW72xrSKp9bEghQLKCal1ziLU/H4sz0P7XSzr7Y7L2u2gOuRAZcxYn88T1n1vSh9l1SCTfQu8GBXAmoWgPIpRtgC5rDhTUaiuTtMyRanKC/UkIjW4pXLre2LC6YB+0Xmysn+Fk4YeonRGXLF53Ytw73QY4hDLKNdJorEECIU1XP/HG6BwNczVe8u2ZdHY8wu+Pww= 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: Convert unlock_zspage() to use zsdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 7ec616ec5cf5..affb2755d9d7 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -2102,11 +2102,11 @@ static void lock_zspage(struct zspage *zspage) */ static void unlock_zspage(struct zspage *zspage) { - struct page *page = get_first_page(zspage); + struct zsdesc *zsdesc = get_first_zsdesc(zspage); do { - unlock_page(page); - } while ((page = get_next_page(page)) != NULL); + unlock_zsdesc(zsdesc); + } while ((zsdesc = get_next_zsdesc(zsdesc)) != NULL); } #endif /* CONFIG_ZPOOL */ From patchwork Mon Feb 20 13:22:10 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: 13146445 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 EF3DDC05027 for ; Mon, 20 Feb 2023 13:23:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E8366B008A; Mon, 20 Feb 2023 08:23:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 898726B008C; Mon, 20 Feb 2023 08:23:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 761576B0092; Mon, 20 Feb 2023 08:23:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 621006B008A for ; Mon, 20 Feb 2023 08:23:23 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2A2CE1603F8 for ; Mon, 20 Feb 2023 13:23:23 +0000 (UTC) X-FDA: 80487736686.26.8798CC0 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by imf27.hostedemail.com (Postfix) with ESMTP id C888E40016 for ; Mon, 20 Feb 2023 13:23:20 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=VUYjSIRc; spf=pass (imf27.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.45 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=1676899400; 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=D2Zvt1PWU1etQHhY4xpQEICva/YkZJeRQbp3ItrgXsw=; b=CuwF93rqkkHMPRcz5vx2/KDYqItpsEInwHZR8HcA6sVXqZA0ys+J3CFrRy++gqThiZaaV6 7prCKZcKNDqIlOypliNHLlMSEhtw3RnZ6xw3dzxYDOE7IvidKyl9+0L6Zzp0K/e0h9o1mu 2iJvuOmQmJK8YI32cF4mvKOk8kR+/iA= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=VUYjSIRc; spf=pass (imf27.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.45 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=1676899400; a=rsa-sha256; cv=none; b=0HQB5CIdvtNYVHO1xwBCIfJmC5n8jlBBfyIplvLRL0qOY2eNBqKFt3MrZBQobahUPfEIUX R5X7ACvRwv5VgaHwAdfBcIwjWkB/+p9inwhy5BnHDAdFzi91efKslyZXIel9wFAJ164amV ZHT9zr4MIbqc8pQz55hv4FCl/hM9LHo= Received: by mail-pj1-f45.google.com with SMTP id o16so1402478pjp.3 for ; Mon, 20 Feb 2023 05:23:20 -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=D2Zvt1PWU1etQHhY4xpQEICva/YkZJeRQbp3ItrgXsw=; b=VUYjSIRcVixbLe3xPQCr6MSzJqAvX7wJfsRyt/sZn8h0pRqA0Ic2RETEHOe368HamJ zmD4koHeNNiNThQWWh5wX8xYaCuQuUHPAaoZoLZdRcSZFTGnpqwAkRVDnABfyEmzqk2V a8v3PTE3u33d7+dBLbmFANNe0zU0O85zE1VI7jVBOrd65zOI9tp+sDyum/gZUvkRa9RF PPAE449HsFFt0eYrqPFCPN8Px+Xbt6/vXmTIzpig8Y9R+2Ws2WSgzSpRAUeGJeUqhc4d yXDJ7OPLFoG0ICx1Xz4KowRn+rzz0+tFxikvSkij5fuvfcSWfgY+IiDoTSVKBzytNCHj sIvQ== 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=D2Zvt1PWU1etQHhY4xpQEICva/YkZJeRQbp3ItrgXsw=; b=X9Lv70sN1om3PekEh2Ix12I80CT68LaH0j+YpaFw+DGXYGpigpmy0oMEBmjpYwRckP OCRCPwXY6ryOGZy7N1VL0o4kCTmk8oQgibfzUSDH2iHfM14MCS+mYxKae96++hZcOKoP UjyEZOU79KcBMdNSp6NneqX0hq8AiuJaJ4IKiJVqP7sO9cO5BNyiaM54TT2X0t7AJ2QC kf7hRNOb7htXa++v/kgj7v1c5LRvj9TmwZsmMlO81PYTYoQmbqlrK8fzc8J3Tg6nLq3s efGBL9Xv7p3wSJZY7Y2U80XmPi5QE9o8RJqXmzrnQCmaE36YF8VreW+1dPKNdSJTfjka vMOg== X-Gm-Message-State: AO0yUKVQ5XHGIQCWGqqVF00Kt8/H7hxCloaM2rFO5/us2BSU/nY8C17/ 75Pz1oavOAZnjOJ1wFnr1Mc= X-Google-Smtp-Source: AK7set9kBY2tKAUlp8fzqSE48cXlGlqRLv9ge6rH9m4t8faWGHmmq2w6yWmlI1z0SmynJL/CTmDFyA== X-Received: by 2002:a17:902:ecc4:b0:196:8292:e879 with SMTP id a4-20020a170902ecc400b001968292e879mr2948386plh.1.1676899399699; Mon, 20 Feb 2023 05:23:19 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:18 -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 17/25] mm/zsmalloc: convert location_to_obj() to use zsdesc Date: Mon, 20 Feb 2023 13:22:10 +0000 Message-Id: <20230220132218.546369-18-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-Rspamd-Queue-Id: C888E40016 X-Stat-Signature: zfabszp5hhrj5fpjod6gg3abju5gxya5 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1676899400-596875 X-HE-Meta: U2FsdGVkX1/DYvBtP9ou13hEEzy0trjHTW2gOZQNE/++gJHOCy5lwgQDyPfqisJHgrEseddZ+ylQ7yRatuTWAG3YUsvzD0+fTqUH6ZosNWU/UTVm75uFEAvlecMAavhionzBAPfAgHTD0RxOzsIrKbryax3dMNMul1DoCRpliIoeMxiK1EvcacomhtuVaxBi52uWUwBYypkpfmvV08FKXkHwcfJxm+kpQz5N64OJd8aNKgebs3FYoAwlaPk4QMBv4eimLSO5kLs559mXOSDLK/CjEhNyy4YsaadJUg2KD0Ao9iERcO3frjqacsHT6tNsLZomhb/aLCHtRuytq0OvDdIji7k1SvUThcYGWwN1qqTNyuAc9/8yYk4SoG8W60Ru7qnczIkOni97Q4R4CBlLmq/ZPYUSsVWt0PMvuB43lTQ7FI+KKccK3gwAtOFdc81gVLm7S2zdbBSm6Kvypi7x0GcG0jK5f3uy6n2DbOp9CPhtW5VcFf5Bf8qh18lfKwpYW1hMFCtJUuWMsvH3eXKGu2tm0TVyguvddBAxV7DlJ0nqin24oXM/ipnqUMSQ/8Oq3GJqAjcfgIgQ8Qjd7T7TqvyoZDhOHQ2oAJV3tYr63UlHyJ5ETzc7Tzl0p7FgsLqooGqYS0QqQXo3cIc1bBMYBGkjaMZyBvruQRz5SuU4Xkezea02CHh5y9TDlvquY7y+7Aq/g18WJpmGTpa+4jC04rq5FHCQTtk/iitbR/vW38gW7+EuspFrlwo1MR85OKswzYjPeuY8WL43+T+ko+ooTMjowIlTpmcDHFPvk0TY7tzIlUg38OmoFxMShtKHAOAlMp/sDnNLZ8n6YFuHvkcCU96PTlt257sQxBwyku/N9/wCpNfFF6H7ZLmVMY0mL1VuTsytc8AovzDeszselB8ouzW6bKitv9AYXDQQM100qWlJXxgTuT4Z5x9B/nb75gdK5L2tcVZcrZptchlQvnx DcInVkhm w1B85UCbbRRY/e/iUC0KFoPPEzuLw/Vd0rWxY6QidtVrV9MhNlxtF4sdL4eEoPc69Gg23vmxI/stJdX/rws42fAqVCbHAIydyOT4OsxwfMnVxsiWUEJRSjMwyGqN685xhhjG/EaP7H13874yELTR4g9KMCEcnItvm1ifyhgjcB6XDrOtgESoe2TlBmovWX0q5J9uQFsU0Fgx0KyUjBGPm5xqUq+MH3NKtktgmhxy7W8uaxQDbMirQbPpK3Wpjfy3DFNWCdqZFdeFgqxP1riRLwdGYf43uNOz42aEQj3nb5oLVyd6ld43Ga+3RA+6W3PyYmB8g+iwnCJ3TYrh5W/KJIJmuj0ABka6p0okezSY6HOkHsDjC82lhpLfegdolfVPi8yvFGiG9moe780OkRA4WnlxQo6bqDLr7yPkrqoO/YP9P+sRc5uiF3oDbTeUpH/rXBW0x0ojGoAnoga7g2PR6VbKKQs3pdAQkw7I852W+T09CYim6oDJ8WO3zajcDzKujD8UL8gU4FedeUxaFgLAlWacJ+Q8oofJKR7Fr90trBvqFnm7Jf7ybaks0Zr0v4CryfSeazO9fbjzmcg2JAMfD+AkZEBS13BEMuhED 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: As all users of location_to_obj() now use zsdesc, convert location_to_obj() to use zsdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index affb2755d9d7..dbc404045487 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1038,15 +1038,15 @@ static void obj_to_zsdesc(unsigned long obj, struct zsdesc **zsdesc) } /** - * location_to_obj - get obj value encoded from (, ) - * @page: page object resides in zspage + * location_to_obj - get obj value encoded from (, ) + * @zsdesc object resides in zspage * @obj_idx: object index */ -static unsigned long location_to_obj(struct page *page, unsigned int obj_idx) +static unsigned long location_to_obj(struct zsdesc *zsdesc, unsigned int obj_idx) { unsigned long obj; - obj = page_to_pfn(page) << OBJ_INDEX_BITS; + obj = zsdesc_pfn(zsdesc) << OBJ_INDEX_BITS; obj |= obj_idx & OBJ_INDEX_MASK; obj <<= OBJ_TAG_BITS; @@ -1671,7 +1671,7 @@ static unsigned long obj_malloc(struct zs_pool *pool, kunmap_atomic(vaddr); mod_zspage_inuse(zspage, 1); - obj = location_to_obj(zsdesc_page(m_zsdesc), obj); + obj = location_to_obj(m_zsdesc, obj); return obj; } @@ -2252,7 +2252,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, old_obj = handle_to_obj(handle); obj_to_location(old_obj, &dummy, &obj_idx); - new_obj = (unsigned long)location_to_obj(zsdesc_page(new_zsdesc), + new_obj = (unsigned long)location_to_obj(new_zsdesc, obj_idx); record_obj(handle, new_obj); } From patchwork Mon Feb 20 13:22:11 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: 13146446 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 33A1CC64EC4 for ; Mon, 20 Feb 2023 13:23:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C43AE6B008C; Mon, 20 Feb 2023 08:23:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BCCC46B0092; Mon, 20 Feb 2023 08:23:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A949C6B0093; Mon, 20 Feb 2023 08:23:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 9B3706B008C for ; Mon, 20 Feb 2023 08:23:25 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 58AD71C3401 for ; Mon, 20 Feb 2023 13:23:25 +0000 (UTC) X-FDA: 80487736770.01.69610AE Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf04.hostedemail.com (Postfix) with ESMTP id 808A74001C for ; Mon, 20 Feb 2023 13:23:23 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=jIk558op; spf=pass (imf04.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.44 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=1676899403; 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=5mHgCuXAFHph2LKUZmqCnFTzZHFNELK63Gh7ZdcJWvA=; b=Pxbd99qPswCBg0S2tHjAbzotM6rgWlA0CigpxYOK1Hixt28pFNe5wAe9gM1F8GRPwHx+1j 7KpgywbdpCmqbJsmvLhzvngnlXHJs4acqrid0OG3rVdMftV9CATI+A1YMpYg49V5PqRm3m 3yvm4WrvWtBPmPW6UGArPQdCfjVbywc= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=jIk558op; spf=pass (imf04.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.44 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=1676899403; a=rsa-sha256; cv=none; b=GDuZ3OOBF/0fhDbmjYh3yDJMvwU6aQwATqSul09r89YDgbuvT0URVydhjEFgkgRzC97nCr R/XHV7XKvtn0yP6J9G1RSyPXSHlirvNEecvdICVVTsvqIz7IBxCGpA0tEPY0djfKxU+g/q HHqWPItRpSLBM3jI4ZbMZPa/VBZx1pg= Received: by mail-pj1-f44.google.com with SMTP id d1-20020a17090a3b0100b00229ca6a4636so1625136pjc.0 for ; Mon, 20 Feb 2023 05:23:23 -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=5mHgCuXAFHph2LKUZmqCnFTzZHFNELK63Gh7ZdcJWvA=; b=jIk558opicVS9f6LnWCR+d3C+WqaFkFRioiHiDiQbY+A36prJChe8smvSb4tLLtsvZ 6nJliTQtamMG81nSlLHheu60qvX7yTSh+lx8o0Fzhbhr+fgE9Pa66QNINARneBz1FmH2 iNb/hgh53350woCF92a5LxTLQMp8pyuJYnEaBy5pAD/kJQ5fFSz4A0VyO4F7B5CURwWN d2KS9pGJz5gZ+Gd47vu4974ZxlDtpojuz0WKWhWYbzIkcVxboowXXeFhUoR4xi/dE1YA IdtW357tDB43TUXvkUjLzh04zblZY2SGpVx7EfU8+zAL72brLs1xTePMAB4HL4Qai6DI ra6w== 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=5mHgCuXAFHph2LKUZmqCnFTzZHFNELK63Gh7ZdcJWvA=; b=ZKZF0agMXjrIBc2nh5L0TfbQSbnvVqeLokTdSfPOEVi8rtf4BlpVF1YE/PONC/uQQe oNOFpNFJYpMiQqGLs2sZeJns5Getd2eZBCnni+6RmYQb+E7WzgXIrfM97qLeVkVpzC0e 7clVurqoG3Mpl7RIDVC+MrixZH/5c1mCQb1+ObsIV0eq6p+qAviyfGkG4A/fI7RkGTTF nMXOwmrZkooK3Z9y22psd6wTKdz1rNI1hjzNt/xz1mLFAQfIKgg+KdUcv9S+4OSZxyM1 JyscE14bQIJP2duaOeltghPrDovW7mY3rNNhF0zxkPmEVD/zMlnyc85t2NOOyPe2Jj0O n/Og== X-Gm-Message-State: AO0yUKWRsV4B4vITEuigWvJttxjowd9gfR1n0WwYNunad5UZnvNivTTV YG0RSu1GZOQ8jSi8q50WYYg= X-Google-Smtp-Source: AK7set/1GkDPG7WSFlS69VSH+ST2Wj43SkW+CipxrpaQHaTPSUYS6RyCOoVzLda/vbTThiUsJHP+qg== X-Received: by 2002:a17:902:facd:b0:19a:9b87:e73f with SMTP id ld13-20020a170902facd00b0019a9b87e73fmr2520861plb.1.1676899402358; Mon, 20 Feb 2023 05:23:22 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:21 -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 18/25] mm/zsmalloc: convert free_handles() to use zsdesc Date: Mon, 20 Feb 2023 13:22:11 +0000 Message-Id: <20230220132218.546369-19-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: hibhs5ciabbhmz89m3zceiyio47yzgu8 X-Rspam-User: X-Rspamd-Queue-Id: 808A74001C X-Rspamd-Server: rspam06 X-HE-Tag: 1676899403-938384 X-HE-Meta: U2FsdGVkX1/FtpIwZKCCkOSVsKJVngDoAxYwaHo07SAx+ix25SaB7/waLsFVCGvcQTmPP2Zf3qhY/Jaz8viPgyGcVY46bSVNXAvgjcvUNxQ4zohA63F2xf4HkfwPtyMa4bDDsoyRuw9SntQaSc4Yh57W3UJP4bjiuPCPJtN+SXWAxrm+86fpKWrAS36bKqRKcMvJR9cdGgZVII9p/o/i8w24ohv+CmmLBYY9SZ/a8v6YlYf2conIpGkR8Jh/LXh168X+tiKeMzKQUkHEvf6xaVqVBjSavaEF4j/Wl57d9nSX7988jfGp1a6s2D/AU1u48Rrf9zvvSGu0azira/lV6axEMiSRJ0b/fE9CGTE7LB6rRJ4yGmCuMtgJtTdtFGD7fq7y2IhbvBB6l9QLIlnn3nxvUOwJI+7R9RKukHL1zGb6UCx/8kVqZGYE5F/9Kakab9b4oUypO08M8akNbDkwj2OTBVQgJmEy9RvNW4TTG4UfqLcTC6mI+g/SEc7iYlgS8oqv10UbDgDJW06/FaYci9Zs/bKvRrL283UaDttgd1rbvVyYxG5adQM1FrD9TlMSdavIqqPgtboMwkFzq/JcP95rFY2yPzymGgaoM5lE6GcaWy3LdZLtlNBoePUlXuflh5SseCTw+46wXgDpbp6FqkjpsyrHCoE6/HRSRyJpYj5GCjFYY3xcJgyiL7ER7AklViTH8UtYXlws4yDLR5xnvP6xvc500tautMq5ouT+UIZ4KKaJPhSmiCymtQriS79Kdl8nHu6QXEMIJM5dBlS8Zh3BycwwCZ/nftjcha7FeX+A96CxQqHhHDoUoX4KyuLaP2CIc3sdDeG7Irys3IqMmBBQreieTmwb347kMu9V8PVFycnE8qybSmCTgiEh0DgsrL4UkR3ELKtB9wYSysNJL0/5IisYnBzb/bt9DUdAO01ZkSANqjKE6eKDvRQn9cTToxckJG7ijYFUtRjKI/1 wSVrCzhs 9Sa1RgXF/5P4B7HE0GGcZ+zK2qtXkPSbq4ygNvWUOr3XLXXjkR7KHYB5kDC4ia4ugmOPxT8QZp/6z6STRhy/6fpBTUxbb9zBrJYmh0llwzhd69yZV2AjAzjscFuG4bc20SxDQ6DnYIWsz6WVg3Gfc85NkhONCOSH7CI4AGoozia736PJYl9KYpiHMWp6br+3UHXRw1EvdDd9SkwqNDvzEZ1dlKZjRVf6MV/0M4zTfrYSfkLuq1NwkqtJP6bBVM31252wJzan2iuXPJJIzfyATkO/zg9f8sIRLi+u5WzAnQcVYcSdcXvziq6M+7aj58AMYLYn79gA6MV+2zRg6mwLxpc4CJZqVJegVuJcl2Lm69b+bKrIXAy/Owl5YzG/Wf5XNpOd5MZ25s8yNgaxFYw6UPMulmEAS+Ohn6j6X9G3wj07+ryVmLY3KvQ5Glji/Z7iG+TKndJsnKtRAFko1yU4wh6xFEVVc0RntR+7dkr0nZ/SMsCb1rcb6ZpASskoiJODx0MxpHTeB+kp/nagyrcrtSMYZWaUtD8NoYLPBIcYFCWpbAmGurf2bIOfSiM8kngsidkho6pLPbQvR1n4LsTSHDA3wK/Gp6H8A4IS3 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: Convert free_handles() to use zsdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index dbc404045487..b58821b3494b 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1123,14 +1123,14 @@ static void free_handles(struct zs_pool *pool, struct size_class *class, struct zspage *zspage) { int obj_idx = 0; - struct page *page = get_first_page(zspage); + struct zsdesc *zsdesc = get_first_zsdesc(zspage); unsigned long handle; while (1) { - handle = find_deferred_handle_obj(class, page_zsdesc(page), &obj_idx); + handle = find_deferred_handle_obj(class, zsdesc, &obj_idx); if (!handle) { - page = get_next_page(page); - if (!page) + zsdesc = get_next_zsdesc(zsdesc); + if (!zsdesc) break; obj_idx = 0; continue; From patchwork Mon Feb 20 13:22:12 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: 13146447 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 8189AC64EC4 for ; Mon, 20 Feb 2023 13:23:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D2626B0095; Mon, 20 Feb 2023 08:23:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 935E96B0096; Mon, 20 Feb 2023 08:23:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D6A26B0098; Mon, 20 Feb 2023 08:23:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6EAD56B0095 for ; Mon, 20 Feb 2023 08:23:28 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 449141C5940 for ; Mon, 20 Feb 2023 13:23:28 +0000 (UTC) X-FDA: 80487736896.09.90A8CF6 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf05.hostedemail.com (Postfix) with ESMTP id 65155100012 for ; Mon, 20 Feb 2023 13:23:26 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LHoBGeXG; spf=pass (imf05.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.176 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=1676899406; a=rsa-sha256; cv=none; b=Imd+giBn7JYt/Pt3sH6s7srA1srxvJbSDACnwS6xxV/LQdh8QHkjWC+sbUjURW7Jc/BtcV HLIHHqGJodJ21SBL5xOmQs+wRhBnNYYpucVfeSjo0eIoBBtsU3BuFLvwSKJNBtkYViJV5J 1mnueb4sZaru5plXc1KwgcPi0roQyUM= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LHoBGeXG; spf=pass (imf05.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.176 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=1676899406; 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=YFFW7TbIH5Wwjb5w8WCVPHYQDkXB5n/0wPIasT499e8=; b=6A3t6azj6nK6DnFiww1kXmx8geNTDNQUiFXwLccZk3ICfg7Ot4Z1WxqYPDbaSo53Q+vTe6 Y9Rk0p4USVaZcekLeUsP6aftdi8ReMg437zABIwhM+8hf06ww4VuS8kgTmApnLcA9tpUf9 oKV4aLXB4fT+vN2zMq99tgISrOrtY50= Received: by mail-pl1-f176.google.com with SMTP id h14so1495819plf.10 for ; Mon, 20 Feb 2023 05:23:26 -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=YFFW7TbIH5Wwjb5w8WCVPHYQDkXB5n/0wPIasT499e8=; b=LHoBGeXG1JM5ADKKAj7NEx3SCXE7GNxuZWej6ZUmPz0OyP6W/pTma+pZvbTQRUx8Wd VhRW3QTeFPcqVDyOfm++knCkmxqmmuV+P+RT4Z1o/jvqPmVCcXZsf0jxNeTLdW8yTm10 fdhMnCSfwPEPijyL1/ZrUzEBnCy5B72zZSWFNj68Je81I6wyNDTkROje2duYp/V5kD0+ jiHn9yotpsAXOiFL1TSV51KBUH5mWGAnqMUgJKTCCP+5OVFtuVVlz93Hprbw4WaTseQu DlJZgHnlunANm3dJb9YgvyAmyYq3qvPiLf9NEpbuEoB5brNOnqNUNg45Nyrm1C/NbhcU PKkw== 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=YFFW7TbIH5Wwjb5w8WCVPHYQDkXB5n/0wPIasT499e8=; b=xU2Vu4vLtZwzhXA4LEUDVUPz5UZLMkqTyPAjQHwZgLphP+rszQQrysE/eNC3cw6fJb xsbiL2lOMSwpe3d9u5vG6hHJje9F8bbAXhK8WPF8JH7Gne5zeWI0DazhYw2yzun1Sthg GgnLVjYNvgtc3rp4wS/b7IUawhdxEbGRHck9vOlf25wx/nC6EOfDjEc6p9lbwN1bi93v 3Vbn639FW99tEVxuc0LKenRFhsTzubkbq4sB4SDsvlYpWloAdx4dfNe0yu+wcYaQJK4Y yyZUADIjjEunDN+Uu4r2SHh0QvHfI/gM5ArtARb9oCkuVFCiQUcloQcmm+HB3l/QOl+s mQ2g== X-Gm-Message-State: AO0yUKXU2IcStdhieaFuuMH7dtHWTIdkyQezLO6/gniNj3DSw3FIL6dT PVH5TJvgm3usLQovyWRJDPs= X-Google-Smtp-Source: AK7set+lk31gD0S1vVCCCM3znjhcSQ6oBdIKo1lMLpkriCR0w1N973DHhN+eRbEKvnVEvAdh3ImNOA== X-Received: by 2002:a17:903:2305:b0:19a:a4fc:7f80 with SMTP id d5-20020a170903230500b0019aa4fc7f80mr4176318plh.26.1676899405284; Mon, 20 Feb 2023 05:23:25 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:24 -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 19/25] mm/zsmalloc: convert zs_compact_control and its users to use zsdesc Date: Mon, 20 Feb 2023 13:22:12 +0000 Message-Id: <20230220132218.546369-20-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-Rspam-User: X-Rspamd-Queue-Id: 65155100012 X-Rspamd-Server: rspam01 X-Stat-Signature: gcdpjx34p78tp9muyxew57egpuoptzpj X-HE-Tag: 1676899406-817324 X-HE-Meta: U2FsdGVkX1/jN/1EhK1tqWmDt3vmkmBs6kyWgsuu+Tr/NgthstFVa1VNRHVX70bARg4yfwgbiOGHSfRdaxLQvgPA5dUlAiqw7ov9iA7OvwFxWhF46CRpm2wpKc3jxb2e0Ky3VYCV78HsvN6abFkH6mv1nRUvg9AwBF/w6B37GOYXj01WaW7J+NIP7BUivZRlNKXP97ypHtxnZ0AJrk+WKOYfj/DI2r9tkd40rzMI3pUFLBnXEKAysDCEaiWeb5bJSVBU6IF67Hmvgi7AausLzoHrMpj8FUaeiBvi6lEbHLf/UFNu+pPJkj6gdFEMLupgsq5eVVvw+KYu2/lqhTdHWfP2GGgtXNlhXYBWNRrYmeoJVKbXgV5w48K5APeKZy69TEIf5z/VqjFLamgPTqOt6zugItG5xV82O2+CGvUGUzEU6An/pwR88U9VwkTSrHdY+eYepNmwo7Xb63lT/8IxrFi2IPKeU1+4wYedRpjwFxcrjF2Nm5nAJ9PgY0shgFRqDgbUfCCqJdcWh7g0CuRluLM4Jp/nEXb3b5DI9W7+TRNa/fZdTP5rMgOkhQzN+InLJ6rOXGAcJavkmQ6OF85ZiOYtk0FEHpZM9AL33rSlNd+BEf8XqM8SF/gh/bfTsOQi5UgisPZzYoVNrw1qmz1cZX9uRGhRfR5brmERYb2rVUl2fwDU+13YUOTiSfYfMxXkjGSXAnhmi9kBg2ijyxCMz4I8lKudh5C/9BApXamM7hANdR1iJFYnOajTIeanJjDF/DDqJRiRdVkot2q3O6yDgUrBo7vYKYE1uikIJzulGOM5SB7tT/Uq1hAVFSxy85XsMtH5fXmTp/BoZw8DEkd2Wt4hRyfeAfos4sf9q9AHiwJi7BO+BRyEjTA0aj1NHJKghSrFDk3kSbPBkbnjvfAu5TfK9zNHrqExPtu6guXe/iYLfanjPQBQxleu27JcHlY17SVm1PNTDufRj0chPBy tjzMNJcn kN7ponFHZZ+G6tlWAtYiVCJthr6qJSSEbjAexHAWRbpybmlXJTLEzKIUmxOSz2Viu/GXFGuy9n5Z5YJhFROL/A8rLJiE5fB4Th4mQAlI1zBgRNdtbCym7q2jQmJSPNZlaaVIPghvH/Q0/qVJew0tXex8Ul2giGQvdclu8eE1HuYSzTCvEEQZKGPkKtF0lR6KUcazzgxkhsWpBFN/1RS4l65z3tp9QgO9f5tMuLRmRMsmNHM0oyUBGE43S6pQn85kGMscGNaUZemWttHVOmSnzpxrgwNtlviKyQ3IrcbMew0Ur+OnEfq2KqP15whmNIQVK11xeFvXKsxKZy4xBIpkSjxwyvxAB6/M6JcNiVTn+k4KTJ47u5/Y91yxlWg5ZjyBYqBPn4/yicAsaJJOpL3iHLpizWTWMf7yByo5yVFf+P5pNer+RSGxXayZ6KtGnmJu2Kxs+IuhZhB0JKro4y7tUvnjtq5QxTnhu71Ov0PBABUgnqK7Y0Y/qd1Zn/gXN2ReS98HkS4Jj6lkqblx6KyI5fFfEI7j8To6hqICT+BAQyuYmk7J8/y4kBHzz7sOtxvIPuLL1CxM/UUIENghaT0InFVJNyndd4cA4id9Qc4vND8Q5fxE= 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: Convert struct zs_compact_control to use zsdesc, update comments accordingly, and also convert its users. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index b58821b3494b..488dc570d660 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1956,12 +1956,12 @@ static unsigned long find_deferred_handle_obj(struct size_class *class, #endif struct zs_compact_control { - /* Source spage for migration which could be a subpage of zspage */ - struct page *s_page; - /* Destination page for migration which should be a first page + /* Source zsdesc for migration which could be a sub-zsdesc of zspage */ + struct zsdesc *s_zsdesc; + /* Destination zsdesc for migration which should be a first zsdesc * of zspage. */ - struct page *d_page; - /* Starting object index within @s_page which used for live object + struct zsdesc *d_zsdesc; + /* Starting object index within @s_zsdesc which used for live object * in the subpage. */ int obj_idx; }; @@ -1971,29 +1971,29 @@ static int migrate_zspage(struct zs_pool *pool, struct size_class *class, { unsigned long used_obj, free_obj; unsigned long handle; - struct page *s_page = cc->s_page; - struct page *d_page = cc->d_page; + struct zsdesc *s_zsdesc = cc->s_zsdesc; + struct zsdesc *d_zsdesc = cc->d_zsdesc; int obj_idx = cc->obj_idx; int ret = 0; while (1) { - handle = find_alloced_obj(class, page_zsdesc(s_page), &obj_idx); + handle = find_alloced_obj(class, s_zsdesc, &obj_idx); if (!handle) { - s_page = get_next_page(s_page); - if (!s_page) + s_zsdesc = get_next_zsdesc(s_zsdesc); + if (!s_zsdesc) break; obj_idx = 0; continue; } /* Stop if there is no more space */ - if (zspage_full(class, get_zspage(d_page))) { + if (zspage_full(class, get_zspage(zsdesc_page(d_zsdesc)))) { ret = -ENOMEM; break; } used_obj = handle_to_obj(handle); - free_obj = obj_malloc(pool, get_zspage(d_page), handle); + free_obj = obj_malloc(pool, get_zspage(zsdesc_page(d_zsdesc)), handle); zs_object_copy(class, free_obj, used_obj); obj_idx++; record_obj(handle, free_obj); @@ -2001,7 +2001,7 @@ static int migrate_zspage(struct zs_pool *pool, struct size_class *class, } /* Remember last position in this iteration */ - cc->s_page = s_page; + cc->s_zsdesc = s_zsdesc; cc->obj_idx = obj_idx; return ret; @@ -2410,12 +2410,12 @@ static unsigned long __zs_compact(struct zs_pool *pool, break; cc.obj_idx = 0; - cc.s_page = get_first_page(src_zspage); + cc.s_zsdesc = get_first_zsdesc(src_zspage); while ((dst_zspage = isolate_zspage(class, false))) { migrate_write_lock_nested(dst_zspage); - cc.d_page = get_first_page(dst_zspage); + cc.d_zsdesc = get_first_zsdesc(dst_zspage); /* * If there is no more space in dst_page, resched * and see if anyone had allocated another zspage. From patchwork Mon Feb 20 13:22:13 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: 13146448 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 E9331C05027 for ; Mon, 20 Feb 2023 13:23:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C2C46B0096; Mon, 20 Feb 2023 08:23:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 84B566B0098; Mon, 20 Feb 2023 08:23:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64F036B0099; Mon, 20 Feb 2023 08:23:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 54BC26B0096 for ; Mon, 20 Feb 2023 08:23:31 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 2A9521A03D7 for ; Mon, 20 Feb 2023 13:23:31 +0000 (UTC) X-FDA: 80487737022.11.E8E0007 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by imf03.hostedemail.com (Postfix) with ESMTP id 4F55920021 for ; Mon, 20 Feb 2023 13:23:29 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Mt4IlRK1; spf=pass (imf03.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.45 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=1676899409; 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=C5IUaL/geH4eySXyalPV/SSldT4sistEiDMldLKMCrw=; b=DdaH5DdAZpmUinZLiEvM4CpF1ASmb1v9gL/0SNiwqPobutb5pA3uzlYwnQFwi+C+gA3dJD BYwlo8NysUdj2ZUL/oF7H9XRZNkZCVxb6N/oJgri12zNd5lL+x5tZWLbF0+g7yZHBaelAH euEa8FW7s9h7hpWSpwq5/OUMGGpjTGY= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Mt4IlRK1; spf=pass (imf03.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.45 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=1676899409; a=rsa-sha256; cv=none; b=71HqT8+ooTZSoPJxfkb5hD5qOUOZtGvEvt1Z9alVw5jAOvVphlDB39voxZeK+VULatBZUj kf7MqpIQSAqnttckIxXDZgi6zPAEWTSgE/m7FkiMNEp5dvq8UC290cUx15k69JvsWmzQ4z fR07SckVnmCvoDwD7XDkMER8f8d/674= Received: by mail-pj1-f45.google.com with SMTP id il18-20020a17090b165200b0023127b2d602so1444874pjb.2 for ; Mon, 20 Feb 2023 05:23:29 -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=C5IUaL/geH4eySXyalPV/SSldT4sistEiDMldLKMCrw=; b=Mt4IlRK1Bv5G2q1nnUbtT7QUFXJRMoFYqy4PPYLB2hFZVjyuEZbdkYv3z9mtjV7ehr TmnBcuh5O66LzU9ltlrbSht93Pha8SCD4+sBcmtuSwT+jOnX2NPaJQmWltK64b/mX8ZZ ZadpOFVlxLALZs6ZsqLPtmrK0Xf2o8Kb6umtAq6V9JRnloC/dEECR2bUBe67SMRIJI6G 6FkPKcma/fZKU1gibcO45aSaXwwjCfTY2DAiOEQhtNsQ4AbZRCGWmuyfYZw/7mLxDAj3 SS8PpYq0aW/pLwa25Pi+0I0JMx58X8ZEtaF4fMY21Se4GJFbXWO1wRyqrciL0n+CP3ge 5+sQ== 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=C5IUaL/geH4eySXyalPV/SSldT4sistEiDMldLKMCrw=; b=qUaoT/TD66rWOu0UCoiq3unRBG6afhuOJCsJJ7Aa3az2PecA3mTvtnrmYqOrq/fEoq TPqiRX58e40DxUYSkK0PRaxVKZRY11eExK3sq7w9mt+MTyCR1u5S6BvDDBCRx4L4Mny5 wFCBx4uMMa6INvk23Ci36Rsm8AhswAOf23Zf68tL9slYO1TI4P5KPS37WfkvRnikVyA0 AasLmcWWPloLIZwFFafEUNJ1OkWbKATmMZ4Pc9cXHVgH3y25Jwwcn6rng0Gq1eBZMMXK GixnMczIs1Xsk/+NnGmE6NjH1YrHtVBCHKp4I/qDhvpslo0ntlnwsZXWMM2NvyIAiSvK EbBw== X-Gm-Message-State: AO0yUKXlEnVdwyX4sy7zvghbveUWz5oh9r5nzLuXtaA+75pjEJw1lk7b oiAYwbQHw2fWlEW4azpAjaw= X-Google-Smtp-Source: AK7set+S8fPdn/7npwZuUtc+YEMKktETU36plCi5njdU2DDCMZj6Y3YcR4ncdfSj/d04Afgvsp7zfg== X-Received: by 2002:a17:902:cf45:b0:198:f0ec:18ad with SMTP id e5-20020a170902cf4500b00198f0ec18admr2438912plg.60.1676899408183; Mon, 20 Feb 2023 05:23:28 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:27 -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 20/25] mm/zsmalloc: convert get_zspage() to take zsdesc Date: Mon, 20 Feb 2023 13:22:13 +0000 Message-Id: <20230220132218.546369-21-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-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: ssr39ag87agt5jpaxjj674ser8a6jesi X-Rspamd-Queue-Id: 4F55920021 X-HE-Tag: 1676899409-93834 X-HE-Meta: U2FsdGVkX1/s4ql4Y7x1Vr4Ow/oACYADyFKEkAk16xBoz5adSrIhG6y+yC3cqXR+AW3xGZ+kWvCMtJRxOsAasR9MyGfDCX+KHz/VgAzfVUEYNuFP/b7lAaeomsCRNvChuyToB9vSB3MfwcIUMNxdT1IEY50rv0eXIoe47HPGbXgu64Xs5iY8c5bCrg4YBxxQDa//kANQYg1JrzZZoaF8NgcXwJEuWL44mESyzkWS7n1zv/mWCeKCp793ZADSR1td9jfTpC6hyHNogmp/nLWnv5Do6GPW07X68awt+y9y8RpW4v9SpoFP3w2I8VUoKLEyXn+TXD0le/5Hy8T56uwz0mz14dbLJQ0H9E23c8Sz8VNlZ7Rv1FaFp9+c4FkN+RSGsCMLuxovBAeLruTsVUmMKxOfJB77HWXJS6kwUA+KHgIASFRVxVMQfql1SUYG+761Tx6qVkHHubyTZ9f8h/bnLb8FNmBI0KZbDjA7uCKHeVpBeby+u5UN39L6SMs2DZsYGPNN/8xtI6D8CGRAuGUIxIyQLt+74j3S13NtI1xv2bZP0NDDL4uVqOFEdmxQttc+QKElnWTgXDy66oval+W/5G8e0X0kwqE5VXRqrJr42oDJed4nMCEYFrzIUJ5s+r0tS1CkbkYWiPgO23y2wNx6yy2dwYkHRihLc08XXp1+iRdUXhHvxbNKOWf3KcWXDFZrdBrYPmYNlzFo2ew+FOzSbk5CFQKQQpEf8nUxxvBgQopohf2G4SUYuxBAMT9LYXOW9xCTN/t3knHe54h+8ey/uTfmOldcWkf62zbq41n3Rlcoyt/l9t8tOPLt+B4xFq7bKbHEXcHj9vAvniawIEjKjsNUUdnDnJcEbPPxZXx5C1RGqgNOeUtwi1HEK9pjEdcra9Y6t8ZS2A+7rcSS7l2naTXKJ+1lD0vTu0vYvIIITN6+FxoOIGN+U8x/2PO9Pw8Ps5WSmU3lsywjR2Y9YAy cx5oBuXp QIwHWHI3uw6a5daPPPBC3Qwvq7einqn0aWBEVXNGEAK9XcDG1gbusQPudvWb9239ai/G9STQyDqqkiyxH5XiebQCOFmR2MTSGHITIhflBVyHHfB2gvX9f9XuY24P9C+18pHobtUV6G43LL9C887m6Zo61TUiS/keI/bmB8GSkF9Ni0dM5gk9QRzuMtmKOM6PLSv69Xsdb0HZ8j1qxvEuspIiRH06ngnsA7EM1kZHrcDW2EJahzIkl2tbAXCYZRwM/TSMGfrqxQaF8IeAbKyT4RBLdw/jOBDb8Q4Pe/v76tMHxPNA+gYa60yftAYb/FL3Eb1Rx7AgPGz75Qtr/2MUJr66Zx7RHfMcPhzu5Q1p1MAdWNPVbrr2Gs6G44zXicaJ4ZRH2zNk/JB6/ktXRltqpyES0lLfxVq/wJ+ZRo0KzN8n6q8oERT8aNQ1KQPIEFVQkHCwA9EnjXwEuVHwfCX5Dy0eg463wOHfZTICRNmQncItddm8L+858oYlSy+1hfAz4CveIklWYEQ0hMst+/SJgVizm/XZq52ztWYtqJ4KxEe/8M12bphlJU8Xf6pITjkW2zyIfo8Yu2NGVTMvrJzEwQL0ElME553TLQPsj 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: Now that all users except get_next_page() (which will be removed in later patch) use zsdesc, convert get_zspage() to take zsdesc instead of page. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 488dc570d660..5af0fee6e3ed 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -989,9 +989,9 @@ static enum fullness_group fix_fullness_group(struct size_class *class, return newfg; } -static struct zspage *get_zspage(struct page *page) +static struct zspage *get_zspage(struct zsdesc *zsdesc) { - struct zspage *zspage = (struct zspage *)page_private(page); + struct zspage *zspage = zsdesc->zspage; BUG_ON(zspage->magic != ZSPAGE_MAGIC); return zspage; @@ -999,7 +999,7 @@ static struct zspage *get_zspage(struct page *page) static __maybe_unused struct page *get_next_page(struct page *page) { - struct zspage *zspage = get_zspage(page); + struct zspage *zspage = get_zspage(page_zsdesc(page)); if (unlikely(ZsHugePage(zspage))) return NULL; @@ -1009,7 +1009,7 @@ static __maybe_unused struct page *get_next_page(struct page *page) static __maybe_unused struct zsdesc *get_next_zsdesc(struct zsdesc *zsdesc) { - struct zspage *zspage = get_zspage(zsdesc_page(zsdesc)); + struct zspage *zspage = get_zspage(zsdesc); if (unlikely(ZsHugePage(zspage))) return NULL; @@ -1062,7 +1062,7 @@ static bool obj_tagged(struct zsdesc *zsdesc, void *obj, unsigned long *phandle, int tag) { unsigned long handle; - struct zspage *zspage = get_zspage(zsdesc_page(zsdesc)); + struct zspage *zspage = get_zspage(zsdesc); if (unlikely(ZsHugePage(zspage))) { VM_BUG_ON_PAGE(!is_first_zsdesc(zsdesc), zsdesc_page(zsdesc)); @@ -1518,7 +1518,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, spin_lock(&pool->lock); obj = handle_to_obj(handle); obj_to_location(obj, &zsdesc, &obj_idx); - zspage = get_zspage(zsdesc_page(zsdesc)); + zspage = get_zspage(zsdesc); #ifdef CONFIG_ZPOOL /* @@ -1593,7 +1593,7 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) obj = handle_to_obj(handle); obj_to_location(obj, &zsdesc, &obj_idx); - zspage = get_zspage(zsdesc_page(zsdesc)); + zspage = get_zspage(zsdesc); class = zspage_class(pool, zspage); off = (class->size * obj_idx) & ~PAGE_MASK; @@ -1757,7 +1757,7 @@ static void obj_free(int class_size, unsigned long obj, unsigned long *handle) obj_to_location(obj, &f_zsdesc, &f_objidx); f_offset = (class_size * f_objidx) & ~PAGE_MASK; - zspage = get_zspage(zsdesc_page(f_zsdesc)); + zspage = get_zspage(f_zsdesc); vaddr = zsdesc_kmap_atomic(f_zsdesc); link = (struct link_free *)(vaddr + f_offset); @@ -1804,7 +1804,7 @@ void zs_free(struct zs_pool *pool, unsigned long handle) spin_lock(&pool->lock); obj = handle_to_obj(handle); obj_to_zsdesc(obj, &f_zsdesc); - zspage = get_zspage(zsdesc_page(f_zsdesc)); + zspage = get_zspage(f_zsdesc); class = zspage_class(pool, zspage); class_stat_dec(class, OBJ_USED, 1); @@ -1987,13 +1987,13 @@ static int migrate_zspage(struct zs_pool *pool, struct size_class *class, } /* Stop if there is no more space */ - if (zspage_full(class, get_zspage(zsdesc_page(d_zsdesc)))) { + if (zspage_full(class, get_zspage(d_zsdesc))) { ret = -ENOMEM; break; } used_obj = handle_to_obj(handle); - free_obj = obj_malloc(pool, get_zspage(zsdesc_page(d_zsdesc)), handle); + free_obj = obj_malloc(pool, get_zspage(d_zsdesc), handle); zs_object_copy(class, free_obj, used_obj); obj_idx++; record_obj(handle, free_obj); @@ -2189,7 +2189,7 @@ static bool zs_page_isolate(struct page *page, isolate_mode_t mode) */ VM_BUG_ON_PAGE(zsdesc_is_isolated(zsdesc), zsdesc_page(zsdesc)); - zspage = get_zspage(zsdesc_page(zsdesc)); + zspage = get_zspage(zsdesc); migrate_write_lock(zspage); inc_zspage_isolation(zspage); migrate_write_unlock(zspage); @@ -2223,7 +2223,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, VM_BUG_ON_PAGE(!zsdesc_is_isolated(zsdesc), zsdesc_page(zsdesc)); /* The page is locked, so this pointer must remain valid */ - zspage = get_zspage(zsdesc_page(zsdesc)); + zspage = get_zspage(zsdesc); pool = zspage->pool; /* @@ -2287,7 +2287,7 @@ static void zs_page_putback(struct page *page) VM_BUG_ON_PAGE(!zsdesc_is_isolated(zsdesc), zsdesc_page(zsdesc)); - zspage = get_zspage(zsdesc_page(zsdesc)); + zspage = get_zspage(zsdesc); migrate_write_lock(zspage); dec_zspage_isolation(zspage); migrate_write_unlock(zspage); From patchwork Mon Feb 20 13:22:14 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: 13146449 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 6227CC05027 for ; Mon, 20 Feb 2023 13:23:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EDC2F6B0098; Mon, 20 Feb 2023 08:23:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E8BBC6B0099; Mon, 20 Feb 2023 08:23:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D54826B009A; Mon, 20 Feb 2023 08:23:33 -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 C59256B0098 for ; Mon, 20 Feb 2023 08:23:33 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A3EC3806CD for ; Mon, 20 Feb 2023 13:23:33 +0000 (UTC) X-FDA: 80487737106.23.BA4FD6E Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf01.hostedemail.com (Postfix) with ESMTP id D297640010 for ; Mon, 20 Feb 2023 13:23:31 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nMwt1Pdv; spf=pass (imf01.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.179 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=1676899411; 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=7a03/P6hFidoitBllB4mK3vwdRJStJLOrtRldGH4AfI=; b=s4b5LqfbrG9nPVac0ENaacJ7hghNs2eVBK6XNqKMR8rfXeh1ssnz4WtQdYptsxv8AKy8NU QXV/vdgk7qlmFvgXt+wbQvMltvpBV4Flk0ZBF4ywRUX8pzlBJ5Baq1qYfGGpVLdhRBFlsu eN3ljwYdm2VHf/Rk60+IgBhAkqDnDzg= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nMwt1Pdv; spf=pass (imf01.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.179 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=1676899411; a=rsa-sha256; cv=none; b=gdRf6CBHFOamzaC1e50Mr6Vj3dZX0LGgyGHga4M/UQc6wJSetTBq+DHRoxKpatSZ+UHsd8 UiskYCxr7N+cK1WyoLOSFN1BZyeNGZwW9ELEsG85I8XQCS5xKYWwYtrWRPG6Sn0Oze77f+ OjulU5pjaIqslGLy9EqNl+DzY0M6ELI= Received: by mail-pl1-f179.google.com with SMTP id q11so1666952plx.5 for ; Mon, 20 Feb 2023 05:23:31 -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=7a03/P6hFidoitBllB4mK3vwdRJStJLOrtRldGH4AfI=; b=nMwt1PdvsteeTmoduP/xdo2UXS/AsFsCRaRgWMDKXOhN356Lv+sBKSXR+gTfJrbVd6 bHG30sP/BWKeCkj9vWaIO+rRraygiOie79pbS3sWdmnkokPvTFujcYJMyZNYYbSPhQu9 MMULwGB4IKMILVtFCNsnwiyHGyuq9Pevivqj5FJA3km4YLmASYBm65JQJv9zNBlxss0S HQEPjfcoNi3YlA7oUUEuPw/NxOZA3Y0cKW+C0nl+EFCQKHC3X9MJ2L8QJh154TDrP9HT xOiZ4byPiAwtVdBvhtNK1jBE2RUBqZtGHXxu2AbYq9L9UllPQNhtlSkRQq3Ucmco2B1q Ioyw== 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=7a03/P6hFidoitBllB4mK3vwdRJStJLOrtRldGH4AfI=; b=3jpTMP9e4ag97m9jmpVoTrS1cb/4glPXAlY1j0174KJfJBzwpUAtvBRtMOEU3oHIJr vztta/oZpBVlloQjZ3BZ3n9CocZ77P9F7ZLznJ1tiyE2FSr4QNvG9JvjuRAelGnDNJG3 Q1XgQf5Gt48fKErt6Kmrkq1HGMn2tzOLmi90D+xJXsHwtal+UU8SrQhW1mJWeQ4RG1QU i1buKFtalQK7AxoLHGaz4fHvIgcTFcQd2hcmg5SLagOxFy9fnQ7HroK9yLohUxFY+2FW kjqD3NfN7MguLu68GtJMZtycasSRFb16qul0qLp04gBMk2BwZ9CHPHAPTEX5p73UW5xz oCmA== X-Gm-Message-State: AO0yUKVdO2/cf6jh+x+Q8PdiRrSMtkbyjuuDaWpII9tnif8nOF0eIVvx 5lYNVCbqfuBqIeoNn+klqko= X-Google-Smtp-Source: AK7set8tna5Ng7CyA9kkxw1OklqZY/6FKqijDKIBleOtBlRPG+naHYjUQ9INk/YGDG2q+oGDDZjOwg== X-Received: by 2002:a17:903:189:b0:19a:a815:285e with SMTP id z9-20020a170903018900b0019aa815285emr4138665plg.62.1676899410777; Mon, 20 Feb 2023 05:23:30 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:30 -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 21/25] mm/zsmalloc: convert SetZsPageMovable() to use zsdesc Date: Mon, 20 Feb 2023 13:22:14 +0000 Message-Id: <20230220132218.546369-22-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-Rspamd-Queue-Id: D297640010 X-Stat-Signature: m98jswkoa5ku5hxcsqogtn8a1n396e8a X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1676899411-487123 X-HE-Meta: U2FsdGVkX18gpgvN+bkJvmkjec892SOXYuWjcmLbBIPuYcR/lKq+acgBIwynBjAGLyWJCzZ68pnbFkvLt64KZ/mh/QfONmiudy/j7XhTXSrXecRqg9oNqMJPgRCrxJp3W5ggBIFB7alZH4SrUpR3L2IwBKgGUm6cOwmzJqEzmmTyRMGHGo6klmALt67MmROTBVeRMZ8B3DoBfZPx3rLvcDa1FrgOMW2q0X9N1QmX6ogM0FAu8ShztJU7e/xjYWu7BXetRLeEKc37aDfkj6Wp1cfGJuNsXwt/97W8+aS2M81sNL8vldQQWBGCRWwjZKP+O1ywt9Pg9RClHHe94ccNsEJbK05Eet3z92MRjh6RtNgf7QnNSxUYYtSfkrUxtDdX91N4ktbvxHMj/DLzDSvKrd77DsnaubGo922tIUJ9fkCdKfcHKXbBw9YW+t7MNB6OADKpdy7629XgfWO2r4sXfwzL7efEZPY+KhpSy1yGo7gYN7hceJ/3V8Roerj7fKhNPIrHKvvIHm79K8yT2+B6mWc0Ug1tFsCkLGGhAAi6ZdDL2M2E1YXnxWSsss5JRCeB9phuS7bISgYp8KsxzZdaQzJQjThvDGbADdkZ5L/2IwGWJO2hSuu6BzWGvOxjaB4KBFF/C4Z+Nx13WR0mE3aErOqJfzebwUah5TNz09hewpSfpFmFm7qCVe9ESKCeeMnVgHINqM9eOu+aa7UWKxwHtufF6GZ81XkkzonTHNyvT40cks6otwktN+i4vjGjP4IJwLhvVqqgSULuhOUYcGL79aoxlweKSskL2pJ2FKr6ZWVR8YGVJ536PSRXFtx6nbxoGoHSVzjbJ+g3r8quJ+5r6p9AxVyb36/jFEsS5yN5DnlU5ADnEfp9u5RPYA6jcgYBH2SY5PtLYZnkETawWbCGZ3hmXoVbPcU97b7yyQ3HQ0VbhJ4yOmPd/2WHJzIeFcqeYPThm0pIRU79hJQX8tR uo6XGqnQ 4NquA5u3Gz7bZo5yW+wHCs6UWWWz0UlwP0+A0RdkWel9XkqZz/mUq47wU63G6RAH7pccbCSbCfLm8HPvPM/KmFlDjacQnMmWGBeWKs0iXcO1BcDZrjypPP+RAM97iA0qgb/iqDKnDomxkMVeb+HvMSTC///3U/xe/xwaaacdtGZYBz6ZuUPQ4Tx06pxrwCnwu9cuSW0/AqPqDcqPoR71tJnfGKJ0kbB0jm3QdYlOrvOMrMoxTldI5WIVMmr0uAESvY3bI730ZDi0eIEKq90iqqh1wECNd0eGsK+3Vj9kqIH5HbS3f2wkGdCX9YTeo83aAbVXqvYROdTOXowp4ls9igKXEr8lF1KEr2iqaCKZLCFFg3XnAoJTfaflLqK7gt1jHVvxmoN+2Ziasujj5HCpPO52JQoEbInvawAglI2R8MdoZB8U55fjgI61R8rURYjK1uTsOIto0lVEd4F4qxhgNqbk6HTao70Y/9Sqrsz54uRMvyN6TCckHTgetoKZi8HlB4Nqf3Bko+s5q+BKrk+UKxkaxo8VT+etQC5+TT9xv6JacbuM+cR6xDuE37g== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000009, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Convert SetZsPageMovable() to use zsdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 5af0fee6e3ed..e9202bb14704 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -2357,13 +2357,13 @@ static void init_deferred_free(struct zs_pool *pool) static void SetZsPageMovable(struct zs_pool *pool, struct zspage *zspage) { - struct page *page = get_first_page(zspage); + struct zsdesc *zsdesc = get_first_zsdesc(zspage); do { - WARN_ON(!trylock_page(page)); - __SetPageMovable(page, &zsmalloc_mops); - unlock_page(page); - } while ((page = get_next_page(page)) != NULL); + WARN_ON(!trylock_zsdesc(zsdesc)); + zsdesc_set_movable(zsdesc); + unlock_zsdesc(zsdesc); + } while ((zsdesc = get_next_zsdesc(zsdesc)) != NULL); } #else static inline void zs_flush_migration(struct zs_pool *pool) { } From patchwork Mon Feb 20 13:22:15 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: 13146450 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 2C5E7C05027 for ; Mon, 20 Feb 2023 13:23:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF5CA6B0078; Mon, 20 Feb 2023 08:23:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BA7916B0099; Mon, 20 Feb 2023 08:23:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A94A86B009A; Mon, 20 Feb 2023 08:23:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9A4B36B0078 for ; Mon, 20 Feb 2023 08:23:36 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 54C2D403EF for ; Mon, 20 Feb 2023 13:23:36 +0000 (UTC) X-FDA: 80487737232.21.A23C277 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf11.hostedemail.com (Postfix) with ESMTP id 850874001D for ; Mon, 20 Feb 2023 13:23:34 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="oQ/UaQb6"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676899414; 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=fklqQHaRQO40JhU8fjbLQjruXgE49zqYwbFi5NZyQ14=; b=tLCDT/4ZAatqMFgcKG4VC8kysfftrrDQ2UOKr7x+Pt4fVZ8HKf+8vyxfoQwB/Oi5DL7A64 9TfYI7KKIlQwBszVDoZtApPOuRUFAdLa7VdM+TacMPtfVcjVHJgneWZ/cwPReb1at+67x3 clpvifwMwb8/2d5bAXKVpVNB5TQIFrA= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="oQ/UaQb6"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676899414; a=rsa-sha256; cv=none; b=AYF5jPFw2WJk7dnwAdskhwRqHoDmDVm300OaS0WMIaTW7ccjF9CitDuC26jGtHkZ8mcRyV 0PlUSyxX03NqebaxALTtZ8z/DszelmZnEW7dyoi8l//xgSUG2pw4P/169J85kCmaZP2i75 tsQeRWc57vZ4XxTWW46lluaI3pkv180= Received: by mail-pj1-f44.google.com with SMTP id co23-20020a17090afe9700b002341fadc370so1377425pjb.1 for ; Mon, 20 Feb 2023 05:23:34 -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=fklqQHaRQO40JhU8fjbLQjruXgE49zqYwbFi5NZyQ14=; b=oQ/UaQb6HsBay0gZCVokOIjgvvN6m8zK5djL3ewbZhKjtMQ1jg0/wf12WvZoJQCiZW E2AFJagUqMl0fc5M2vpUEvfaskyBfNEK0qAg/xXaoC4T8Qd2ormpW7yEFDGmF8RLsppQ v7AbZHWo98p/LTKs9hA4I6dpP7y4nXt/ab+AYFGvOh1ssZuQvq+aBrQLqiB6HPPH0qrt XoXH0w976rTb2Z0GnnaUE/LfBSK8d677f63+x+NOSu2m7MRBOaFAn2eXOWvGAWbBNiCN zHfMRyMQhoRt8kGXvIaD9OlnKdKISlsH3+0uqHMZ6GS0rKALFbMwG0Iy3EpYMXwLluwl HMxA== 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=fklqQHaRQO40JhU8fjbLQjruXgE49zqYwbFi5NZyQ14=; b=E43g40/M6woFjDYwy+eOnL1IcreCfVdpwGuScXht4O5vin4dJSkgNxKeVNUliCdw8M QEaaKeid1A87BxICQmNvgXwYjIZF5EFMdEFP+p6tWDT2AZI0NN/hGYBc4nN/9Qmobrj7 jpdSdv91okbiceKURxFZPaY8fDrjooTulYuQ1K4LNBTIItkayfZSkWYsoiT14piq3qgr FxrnEgByeGAEWE072rdhNAPpxbzZLB9SH+tpudBBN1hhbqwkWwpADgV68UuklioWgUu1 eEkAN1IbWkE+d35jL2e2Ptww0EaQTC72boS2yMlFpibWiFP7sfIv6rzkZrWJbmH4tBrv MwjA== X-Gm-Message-State: AO0yUKVvgGn23+Ux9ZMA2nmlC75nAz+Dc2TPa3e20cHigjKh137R0oVj ia5+9eAG/jLMNU5YW9WsnGmVH3BbJExWuA== X-Google-Smtp-Source: AK7set+L+3KzxmXTcctt4su908z/Pvne63YJgcS28cjuQbS/kvIg64C2kvlWAzeYISCxwnVCjPDJgw== X-Received: by 2002:a17:903:803:b0:19a:a404:af47 with SMTP id kr3-20020a170903080300b0019aa404af47mr1918600plb.4.1676899413505; Mon, 20 Feb 2023 05:23:33 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:32 -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 22/25] mm/zsmalloc: convert restore_freelist() to use zsdesc Date: Mon, 20 Feb 2023 13:22:15 +0000 Message-Id: <20230220132218.546369-23-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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 850874001D X-Stat-Signature: 94o691dwcxr98cq5w36zrdforpwkprej X-HE-Tag: 1676899414-463669 X-HE-Meta: U2FsdGVkX18LT0J3zlLdHhNxYP+zv2+nh16GSdCeo/W4zbiy/f76c18mV7Oz3Tr5fVjVZy1f/EHBb2y0F/7FHfMiltW+a1/eYpE1ulLmQXTMqWiymHPc8vU26mV9crkVJuz9xFyWexMXGWY4NWV6sfdtDvJwgufpXVDySa/6cohAPXbm7QgCIji+4wsHF4iAkQ+66eaQOvMRRAyHOo/kvDG2y4nReZkDTlSRoyKsBn4E304oqVRvHKyQXU1c8DHrLoToXiclH0ONNS2X1Aeaowb2P/4ff1wy1kA1dENnWVZBfKn4ghaKWfwLiNahdAFZ1lgF1NcCwKqqcnUmjp9Cr7h7GMWwcIESHRiEQHVyV8vCRUWVfp4pVR8LCAgxOsTm91otAYhhHEB/Mge1Jfc9t6+/ykRYhTrH1IVT37o6/chUUDTkMUD8wDNPHTXhar4em1rR29XUDh42VY+LleadInxI4eaHJ2ZNfJYmVGf0pfXZg3Yl71vIM26ptGJK/oqGwR0DhBVIoqHZFEXcgfPk9E38AqX96gGLYz2tZy2IR5XmGQ6mD4qFdUMnQL1ZUQx4cYjw4jLfim1PFFIpMngmmRxnM1VfjkNr8pOR07QZpEhOjtKjHbRQHR+ShTh2zwqZwMBJjjaMNskRZDHQz9xIKkOTw2Era2ZobId55wJDukGbbxmEaFr6trQpJX6rHsMPwGIjaCsq0iblGF8iWrbHWxj8W8HPXqEI4xG3jHQwvkbTq7z5bSe6JvGtwST4wHLQ2ZsbrYQ6RKCVWjhf92J89ZqCwqU18QGGK8gQbDtczZIaMeOa8eNY0zwrYk2ydYSsW0z3UIll7JvrfG0KWIv2AGzNRUEhDiIjttCkVTOh2ZEvLUi7715avNB2PrXBp1yZwNhS0j3n8nM1DxjpoyjM8OS56y7VmXK7Vx4EObZsdm8KfJtfimcOePlqvjMW8kHCH205dK6hf2DoHwkcTuL ekq1xlfO DmhbMJikZrn7JmKM6bIdK+e1OivCGASDvqz094RCQZ9nL4ngPJs/kkgQgbH5dQhKPWYoWKeZLD38nbVgLoyPBfX/iLay71U6GqIh4ilTpvm03H42+RhPCb6xYAgTs+eySnfclewOY0RFwWB+JRQ/lQ355plFZPU7VihT8CYuh9m+ymZow6pD4zpdjlZB2Bqx5BAtAtPa8XOLXOVGKPkxRnj5ZBQjNBsZZJnXolcqoaqjz3sxfvtFCp6Q8hsAPGNYYPHsyFAmuGrOn3PuV2GQ6xdmTn/K9+GO+DuezRfObrpyk8IBS/9i52DEjN7fJuuBfsvtvrWDF04Gk//c1a1bmqZWmr1EjDeYdxNjrKCDerRrdRb5pZFu6tpFrMYUAw3yXAdW+t1Fpacs9AtdMLgez2YBtFnHMXJWjjDB4qVO8oYtWxkaSWzWB3MdmxzxFDf8aA7Y/9OV9d7xkVLhJvPDtD9/KqeZG+kHSmUgQ3BShnRats4og5aBMjVeZYCkWRXkveVDZuDFGsHa7TBWVLg3Y9kuZpw66cTEL5pFJGuTzrd2Ze6/WswR2YIKvYCmZvEr9H+WJcQVdGBx03CBsL64b9ROBAWNzrbiyu9K/ 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: Convert restore_freelist() to use zsdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index e9202bb14704..b6ca93012c9a 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -2718,29 +2718,29 @@ static void restore_freelist(struct zs_pool *pool, struct size_class *class, { unsigned int obj_idx = 0; unsigned long handle, off = 0; /* off is within-page offset */ - struct page *page = get_first_page(zspage); + struct zsdesc *zsdesc = get_first_zsdesc(zspage); struct link_free *prev_free = NULL; - void *prev_page_vaddr = NULL; + void *prev_zsdesc_vaddr = NULL; /* in case no free object found */ set_freeobj(zspage, (unsigned int)(-1UL)); - while (page) { - void *vaddr = kmap_atomic(page); - struct page *next_page; + while (zsdesc) { + void *vaddr = zsdesc_kmap_atomic(zsdesc); + struct zsdesc *next_zsdesc; while (off < PAGE_SIZE) { void *obj_addr = vaddr + off; /* skip allocated object */ - if (obj_allocated(page_zsdesc(page), obj_addr, &handle)) { + if (obj_allocated(zsdesc, obj_addr, &handle)) { obj_idx++; off += class->size; continue; } /* free deferred handle from reclaim attempt */ - if (obj_stores_deferred_handle(page_zsdesc(page), obj_addr, &handle)) + if (obj_stores_deferred_handle(zsdesc, obj_addr, &handle)) cache_free_handle(pool, handle); if (prev_free) @@ -2749,10 +2749,10 @@ static void restore_freelist(struct zs_pool *pool, struct size_class *class, set_freeobj(zspage, obj_idx); prev_free = (struct link_free *)vaddr + off / sizeof(*prev_free); - /* if last free object in a previous page, need to unmap */ - if (prev_page_vaddr) { - kunmap_atomic(prev_page_vaddr); - prev_page_vaddr = NULL; + /* if last free object in a previous zsdesc, need to unmap */ + if (prev_zsdesc_vaddr) { + kunmap_atomic(prev_zsdesc_vaddr); + prev_zsdesc_vaddr = NULL; } obj_idx++; @@ -2760,19 +2760,19 @@ static void restore_freelist(struct zs_pool *pool, struct size_class *class, } /* - * Handle the last (full or partial) object on this page. + * Handle the last (full or partial) object on this zsdesc. */ - next_page = get_next_page(page); - if (next_page) { - if (!prev_free || prev_page_vaddr) { + next_zsdesc = get_next_zsdesc(zsdesc); + if (next_zsdesc) { + if (!prev_free || prev_zsdesc_vaddr) { /* * There is no free object in this page, so we can safely * unmap it. */ kunmap_atomic(vaddr); } else { - /* update prev_page_vaddr since prev_free is on this page */ - prev_page_vaddr = vaddr; + /* update prev_zsdesc_vaddr since prev_free is on this zsdesc */ + prev_zsdesc_vaddr = vaddr; } } else { /* this is the last page */ if (prev_free) { @@ -2783,16 +2783,16 @@ static void restore_freelist(struct zs_pool *pool, struct size_class *class, prev_free->next = -1UL << OBJ_TAG_BITS; } - /* unmap previous page (if not done yet) */ - if (prev_page_vaddr) { - kunmap_atomic(prev_page_vaddr); - prev_page_vaddr = NULL; + /* unmap previous zsdesc (if not done yet) */ + if (prev_zsdesc_vaddr) { + kunmap_atomic(prev_zsdesc_vaddr); + prev_zsdesc_vaddr = NULL; } kunmap_atomic(vaddr); } - page = next_page; + zsdesc = next_zsdesc; off %= PAGE_SIZE; } } From patchwork Mon Feb 20 13:22:16 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: 13146451 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 B93E4C05027 for ; Mon, 20 Feb 2023 13:23:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B4946B008C; Mon, 20 Feb 2023 08:23:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 566126B0099; Mon, 20 Feb 2023 08:23:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42BF66B009A; Mon, 20 Feb 2023 08:23:39 -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 3094A6B008C for ; Mon, 20 Feb 2023 08:23:39 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 08E8F160509 for ; Mon, 20 Feb 2023 13:23:39 +0000 (UTC) X-FDA: 80487737358.28.D084CE7 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf14.hostedemail.com (Postfix) with ESMTP id 35296100003 for ; Mon, 20 Feb 2023 13:23:37 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Th71S5AE; spf=pass (imf14.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.172 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=1676899417; 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=rgoxeG6lbKxpgFkDDARmc06MAeDOGzJmDdevVLJlxU4=; b=IMIrdrQpaoxc8X8esN/JVye0HcSe9HJWmgMTtsz7PH/zMvHkXKGaKG2Lplq9rtsk04/3Xb B+iZo1bYMEGxfIFe08d8acT9IF/74x9CsSIx/f4juUsDv8YLgYg8cj4lKEnYtYVIboZeDp NZ6PdzDpR+XiQ3IBmYvLdD6+BmVFFeE= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Th71S5AE; spf=pass (imf14.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.172 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=1676899417; a=rsa-sha256; cv=none; b=lQ+CiazVoSJVe0wFkZi/z8KUlMPjTVEkvYWo5g9tmJR//4O+OSAveX65DTOY8IC/RYsPYv LcDpoBS5nM2Ds4RoNZkgHve7turUIBaSsIMI4qPwCYRuIZ58dEipHmuxOg/qzfG9+uRJNx ESlrYK0tBCpLB5ZDRHwEfmmGG8vjAhk= Received: by mail-pl1-f172.google.com with SMTP id s5so1263395plg.0 for ; Mon, 20 Feb 2023 05:23:36 -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=rgoxeG6lbKxpgFkDDARmc06MAeDOGzJmDdevVLJlxU4=; b=Th71S5AE2gdWm8+Tbt1USoCL8IQYJ2sUaE/e6L7NqdnL8kXaSBI8kT9Cqy9SMr1up+ 4LaP2Y9KZ+ABMvqGIB4yQTsBoHOX6w/x1WL89pT2GfgHQdPnRvN6BXXfEUlNW85X3eTO pqdaox+K2PVVYCWimTHy2Z4eAVgIt8AKYnBX8mkaYJgsx/Q3KotCYFUZM3gLHiHbHxW9 KwKAjHSExLXuBodQnfl6g+BbJNzTWnkfAa1q4K18ef9cF+s/A4nVKlxBvVTOuFiUbtNb BQ2VWQ/SFIrTrjZnydOUkVwZcbZguNg2ZGDAueX60lgXD8po9iXEkcTrHfkVt1x5Gcnc MMJQ== 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=rgoxeG6lbKxpgFkDDARmc06MAeDOGzJmDdevVLJlxU4=; b=mVV5vqaC6MEpSDFia9pZji2rh++PQRECm+KhcfxIS8RmaW5AR1b3t2J6MbMn5y31nC U+O5Z7kH6EJ2SYlQNxgpAPn/tKlhmV38DzLvlRQToF+B1TqRzJGslDPaPkYA9YUZNWc7 ix7I2u4gaIOsm0ckEEVbGW976X4yUAdKZpoe6FrzrvhBlDVRrMcIPQVhlR7uXaz/xE1D GImfp62tiistdGJ9Qz0PnBG7nJNTDaqDXcZhvmSKMeboKAa48cyEhBpFVMizSRAJAT+B GPxUIeuXDzEVGMp3nSSYbIYYfzGgRGT3Svys/0CmuGx4NQyqD+CEyEIi8PjzYsWANoxP vCDw== X-Gm-Message-State: AO0yUKWHeK8RcB2KJ8YLk0UDgYoVdvbUVCjZZhp6JsVJGDq/Fh0kWGVQ nzsp6/g8cVFd7OFiOqyvjvQ= X-Google-Smtp-Source: AK7set8Bp7kH68Es1zY0lt7bJEAC/NYqLArqXNafEN1maUbokgHKFk4Slhti3JriS2OJthqnv7r4Nw== X-Received: by 2002:a17:903:1c5:b0:19a:743e:b148 with SMTP id e5-20020a17090301c500b0019a743eb148mr1088684plh.66.1676899416188; Mon, 20 Feb 2023 05:23:36 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:35 -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 23/25] mm/zsmalloc: convert zs_reclaim_page() to use zsdesc Date: Mon, 20 Feb 2023 13:22:16 +0000 Message-Id: <20230220132218.546369-24-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: natcy61zzyumk1fmqxtbj9zkk68rdhab X-Rspam-User: X-Rspamd-Queue-Id: 35296100003 X-Rspamd-Server: rspam06 X-HE-Tag: 1676899417-479593 X-HE-Meta: U2FsdGVkX1/ag/5TW+E7UojZuj1pv3YVoXtdvY/PnbJ8bwhg2rzjFWiaI2enHnisx8rWeZF3F+qnM3Rm5jxfuvZYa28ncRC4PDDJvY5BzuRQHMyanz4tbN3IupPSxe2zXggA6IEVgiMt5mHstWrGFojApb4ovIv2H9HXocCNB9/sgoshnMhfePmUlnZwBQbJ5KrdZgOqGCTeU5M4Qq8dbKbVBNQmxkC7exFrNQzidehMiQaYlIswwcIu3w+XcHzhGfo2qp0X2h+07Szu1aN9T04MSaDLALu6hJ0GWAEL7ZBVTC8QOom2AFpLbYDTzwU8x4zaYQwmmIcVH1fDPw+ZREdGo8WLIyL4yLyBuZpAIq8Q06C5r1c5cuqtPh8Inst5BP2Yt83aTE96AZGRIleOpKQoopivWgkroWCLYFmrPrOZ2fSvEtLCGPk3lcTTQ5DW5WObCHeSQXnV6d2IvOYFc9nt6tLMIV4xr26NAcSGcAWrlzg9f93tofqNldHwzEgfiBYADlRAMNi/6+auMB3dZC0+dqX1TL5TxbXn3jpWb9heONNjRGfeZgCVXopFIDtgFmSDNlh8LlW4yUtwqqv30luy8kj0oN6S5YXeNkm6vgtXNnhTtMx5SNNZuCUjDYcPv7st0fcAhip5j3IszLcMNO9yFUMLNLdNMsD29/sjNQXX6oMoZ7/3ATcWjJDJqswZjtybgtGz/ftCjnWxFqOocxj9A0o0/JWr+lCZCKPaaBh4D+U6rJj/SPF0vU9dKZRcIcHyDIHM2eujbiHr3AdEtVlrP+qLsF4+jD97g/vkR+1LfLnk7VnllfaJx+eyQcIc99VTnHMl2W3zcQXYG9je0VgLrKQVe+X6Pzn+71Pre+Hsjknu4ViWX1sjFYITKUugWdzRg8fdsXXYnfEPw293HUKQbXFMpo8RSfB6Xzk/uGurZorYY/Ydfdqj+eOPxYTmjuAVn/5/Nuqnk9MVJIE pdDHkZgr 3wVCwvzDbnWw+WJNY/I3LWxx+FGaVB6nAANvP3PPU1Sa0EcL+eXqtC388g/OYu8sC10k6erOjvM5WtHz6xnK6waZG5m7bilBj66Uf6yeUZS9zCIq0urWcrG5fXPQy0R9Up23vTPfPVGBcYhSxAJUk2sLkGGXfg+xEfm5j3LZVm6AZX0RjEIwD1gmscobt46YiL+xJivN5kKZV0+94vhmQ2Ox4xEvgNxRVtGFxu577l4kjnChxTiznJv/tPvDS/ympoFCT6B202UisTfvwQ7RYbNTkLvT8MRQCSWw3Qipgqo/kIZXzXmpMQTdLKqugx4t9R7oLEH4IMCVLLb+86blYw62qOVE8K91hJFAaz9qQppdUw6BClso+n7PLV8yJ/u9r45N8M6dpsIn593qiLcSFqpjclmD5oCfcEcm4vb4DfwUEwK8/ByZJ7y+5ObgbmGIu3NEWXvITOF1m7EP62t/LtX1eSfNIoZ/E6s+B0oOSjZWXSFdFoOtNhAqfllpnNDlgYIQj+6yUmaGsAErmrTLMszcB7xD3J7KVRD92RtW2BA0xRs2vQuYLhFgRv3V+8boQ4t8tqXqrpTb2tmdzpv3nf5LmkQw8GU0Qhq5LW/3t38wVsYQ= 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: Convert zs_reclaim_page() to use zsdesc and update its comments accordingly. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index b6ca93012c9a..7153688f5bca 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -2802,7 +2802,7 @@ static int zs_reclaim_page(struct zs_pool *pool, unsigned int retries) int i, obj_idx, ret = 0; unsigned long handle; struct zspage *zspage; - struct page *page; + struct zsdesc *zsdesc; enum fullness_group fullness; /* Lock LRU and fullness list */ @@ -2830,16 +2830,16 @@ static int zs_reclaim_page(struct zs_pool *pool, unsigned int retries) spin_unlock(&pool->lock); cond_resched(); - /* Lock backing pages into place */ + /* Lock backing zsdescs into place */ lock_zspage(zspage); obj_idx = 0; - page = get_first_page(zspage); + zsdesc = get_first_zsdesc(zspage); while (1) { - handle = find_alloced_obj(class, page_zsdesc(page), &obj_idx); + handle = find_alloced_obj(class, zsdesc, &obj_idx); if (!handle) { - page = get_next_page(page); - if (!page) + zsdesc = get_next_zsdesc(zsdesc); + if (!zsdesc) break; obj_idx = 0; continue; @@ -2870,7 +2870,7 @@ static int zs_reclaim_page(struct zs_pool *pool, unsigned int retries) if (!get_zspage_inuse(zspage)) { /* * Fullness went stale as zs_free() won't touch it - * while the page is removed from the pool. Fix it + * while the zsdesc is removed from the pool. Fix it * up for the check in __free_zspage(). */ zspage->fullness = ZS_EMPTY; From patchwork Mon Feb 20 13:22:17 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: 13146452 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 2559BC05027 for ; Mon, 20 Feb 2023 13:23:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF57B6B0074; Mon, 20 Feb 2023 08:23:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BA6A76B009A; Mon, 20 Feb 2023 08:23:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A94A06B009B; Mon, 20 Feb 2023 08:23:42 -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 98FC46B0074 for ; Mon, 20 Feb 2023 08:23:42 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 69C0DC04F4 for ; Mon, 20 Feb 2023 13:23:42 +0000 (UTC) X-FDA: 80487737484.29.0DEC440 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by imf23.hostedemail.com (Postfix) with ESMTP id 11065140020 for ; Mon, 20 Feb 2023 13:23:39 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RmJBQn07; spf=pass (imf23.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.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=1676899420; 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=MJephf/cE6pyMyxIK1qVn/6WhIHz/ldUDs9NMMmWGv0=; b=0HkmxGyccS10dtMJkqlEECHjnQekbsQOv2aqpTjvU08IvrzsFVG6xiH4AWYanTHIIfHMZR 6EAREa7rKPjAOni1DQwSSEmd/0qQ6Y7+7cUKVNNBoKA/e2FbjTaCDTzoDoRTURSbQ+NB7J 06di6cZ0JcfUYUOIlosIG2a9hxnqAj0= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RmJBQn07; spf=pass (imf23.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.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=1676899420; a=rsa-sha256; cv=none; b=MhMIagS+9rIgTG6toLrQYAK57wdTGn5+q2iT+l0QvaDQznPBqkdDe0PI6RgJiIbsmG7woF GBWLFQJg45YmBmhcY70+HFdTpVmJooFcTP2CKRzIuFl65OhgIVCgseRIeR581S78zlpW6a sku8KLcMBGgGPaVHzDoAB+5j0uYCSIU= Received: by mail-pl1-f173.google.com with SMTP id q12so1420520pln.7 for ; Mon, 20 Feb 2023 05:23:39 -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=MJephf/cE6pyMyxIK1qVn/6WhIHz/ldUDs9NMMmWGv0=; b=RmJBQn078xHGiNh8byqJgJDtnT9qFpabZQQ7h31IEdlfrIxdmWXCmaYK/4pxpRWQU/ wMJbNHkN8VmDfy0O+BC8NvWWLTchE0k/Ox2KEzV5ImBVW/Ls9HQj5q/feTu4HdysEevQ cXpytbHwAZCKTfYv8XGvwdR3OofPKR59spSYoMyx//kkRQ42OECDSZYDbtDoGr+Qfnol m03EsDMrDPMsimStfsBM9LxltnCtEuU0BrfjtdWSAJRYH29pt4a+lDNjySxug2ROccEo /hCJ5Yxfxb2qp1WGsyhruR3c5xUJoLe2g/Fk/zClYC8gyXa6xlMQbAunCuIlj1QDv3Yx 6Eow== 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=MJephf/cE6pyMyxIK1qVn/6WhIHz/ldUDs9NMMmWGv0=; b=WDu+/3jRuzY926WDCHN73zz0qmNYeXFa8Y9hOGtyr4u3675e0FKMqujTDfZmbfI8kt Zjba2B6YuxXqf9pk3ZsSyLypVym9dcmUojgs6pKhiIh5yykDyJomxMKtjvNm8DkhZr3a oLCMZ/Tria0BAQoW8FuXA9QGSuZHrVdkdDeB02IaN5Tw2waTaX1lz+2cjfMyOagnrd5C NuYg5QSG3tvf1MQxnJyNuVG+x0Aws4uimXZtpVrQsKmYpB0sGhziZjBsjslDRQ39nFyW lDWEd4nxC51mqfE0kU0kwUYIVVUxr8paMXhRQEerdNXc97hZXmQ4vZ9SrpLHaMYIfA+G VaQA== X-Gm-Message-State: AO0yUKXY9nfGseFEt9sS4uFARxHRtCMK/BXudcC+teLK+yBXC4S+j4ek 8p5QFEEbtGxFwDe1A1FjXw4= X-Google-Smtp-Source: AK7set9RJqCjyNg4l6UwqBDASUb3Ih7vwTeNyN8bSqpn2BWR8LbKPlnjEgEGxO60/VqfveS8CWYxGA== X-Received: by 2002:a17:903:2345:b0:196:3feb:1f1e with SMTP id c5-20020a170903234500b001963feb1f1emr3156359plh.47.1676899418881; Mon, 20 Feb 2023 05:23:38 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:38 -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 24/25] mm/zsmalloc: remove now unused helper functions Date: Mon, 20 Feb 2023 13:22:17 +0000 Message-Id: <20230220132218.546369-25-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-Rspamd-Queue-Id: 11065140020 X-Stat-Signature: fqcg63cpwc51cmy71zmj5skh8fp9xqa4 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1676899419-553723 X-HE-Meta: U2FsdGVkX197gAbmWzxNfe3ff1dxPtBVDV3uuNs7clRwK0ZOSE7jFXioDlFeg7xMTjIisT1UfzWFZTHRFX8JuKH1qsVYAh5zXSSHK0a1MNSTGBdC37ofmXCpp6kgWLGJOZi3cIkGpCP0gdhsc4J3HbvnpM1xHSUqvzBqPNZhUFPkX4wJqa+MBbXu+wlDe19XqTe/yZecwrOpWvAZxid8E733lgXwfQa0jfhbgOEM8+7/R5Xc7t36bZOFt4lX9C1rY3y1x5hEG94STBnfhOEsPPMxpYwAaIhYM4hcoK8+S6LDcvQfgZ1g+kgj7J2CLgr4q0jvQKTNs8KavpG5vVmsJ9FAa9mFlytdI/8c7t8SSn2+EWSDCnQD3DU6hzfo1dQJL4OulkS6LoQ1w4fZKR6McccWaOHfcKBf+hvbchlJw4EFwaVwE1/u37MPDru/oCfTaBHJwZxuy+4XHmEgPAC5K4o1GCtshfC5Ye3pIV056XHzu13fXSjJ29Gu3VRPB6pNbr2D9OGrnVMcl2bDOs3d7KQo/xoVStDW0IsT0wW6dq6Fa3EXR5Eb42iBjN9wKhoFloOvvUcrUZLIAlaEFWYIxM9tl8lqbT+6h4leUTfi6EzZZIB5thd8csO/HW+W2LJYJzrW+RytdVsdivx28pBLIIO1nQ/agBWHT8wUMdFYnROogJKwur8+i8arVcb3LcSAV5VuYmhYf5ArmGbM6SLzKCW3QK9lybiqk/5pNG22cZ4Q7ESMWMvPVCExNaIXRHPQgxwrattdlamGIEitotl6EZUSRWlhr+BK0q3emOE/hgwcKm++SSZEIejRvGtP4WGNwVErTQw9QWG0W60r1exWSWHNc7u40lO4M4Z2lF+UR4ZZniooGhzNCubAZDHYWPjygTeWCl4ID4hck9/Tj95pnGRLem2kFu9ugFYxJgZiLh7axx7V1J+8pcYW9qqtcYMb+tXmrNMjfYqRTi5ITqW fJpyCh8c 1TCoOwa02sNgoTNi1MAA3bVbw2HD8pPkgKaQRPrTtztFmr7iTBHYcyo4QO8ufI1+wRAE5nMRvHwInt2Ca76PLSO+daEyeIoh4W88qnle4MP/FHWagECEIrb+LGmizHkJV6Mrf1fGAPc5eWjTAPtJSWlFMMwtcQJQiOuvAGtQqE8S7ua2TKR10F/UcqubzxAdAsqHFApJ8faxNvtSGiWOvfQQquXet1LMA/VPZzJjdrZS7Rkbybtr3wJ/zP5Rrrla4Hq2JmT5r6T6WxYJpdv06F6EgQSROAqVYMyPF3i1uRtrfcBXIp2GQPqN4CyEzOYf+DL1QMFdQ+y3FkJK8T458APOop+II+MpJV6k5p5wMOSO+4uEsWfCrB0eusAL1Wkag4CRo7QZeVd8u1/Z9dbpaYeNY1GiQ6QXrcnAd1Ur768cuIu2mkrIbN2eLhANjXE3buzZvzSBuZouuD+n6D6KTastjAcpeo2Tuf98pDrSBV07aG2xqD6HOyse+anIOoJBqJFDFBK0sDmeBuy9KScnwbqDxZWDIU/JgNTqruBQoV2M9b/GD9vxOSPdsOw== 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: All users of is_first_page(), get_first_page(), get_next_page() are now converted to use new helper functions that takes zsdesc. Remove now unused helper functions. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 7153688f5bca..59fe8d469aed 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -659,11 +659,6 @@ static DEFINE_PER_CPU(struct mapping_area, zs_map_area) = { .lock = INIT_LOCAL_LOCK(lock), }; -static __maybe_unused int is_first_page(struct page *page) -{ - return PagePrivate(page); -} - static __maybe_unused int is_first_zsdesc(struct zsdesc *zsdesc) { return PagePrivate(zsdesc_page(zsdesc)); @@ -681,15 +676,7 @@ static inline void mod_zspage_inuse(struct zspage *zspage, int val) zspage->inuse += val; } -static __maybe_unused inline struct page *get_first_page(struct zspage *zspage) -{ - struct page *first_page = zsdesc_page(zspage->first_zsdesc); - - VM_BUG_ON_PAGE(!is_first_page(first_page), first_page); - return first_page; -} - -static __maybe_unused struct zsdesc *get_first_zsdesc(struct zspage *zspage) +static struct zsdesc *get_first_zsdesc(struct zspage *zspage) { struct zsdesc *first_zsdesc = zspage->first_zsdesc; @@ -997,17 +984,7 @@ static struct zspage *get_zspage(struct zsdesc *zsdesc) return zspage; } -static __maybe_unused struct page *get_next_page(struct page *page) -{ - struct zspage *zspage = get_zspage(page_zsdesc(page)); - - if (unlikely(ZsHugePage(zspage))) - return NULL; - - return (struct page *)page->index; -} - -static __maybe_unused struct zsdesc *get_next_zsdesc(struct zsdesc *zsdesc) +static struct zsdesc *get_next_zsdesc(struct zsdesc *zsdesc) { struct zspage *zspage = get_zspage(zsdesc); From patchwork Mon Feb 20 13:22:18 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: 13146457 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 9D766C636CC for ; Mon, 20 Feb 2023 13:31:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 315FE6B0081; Mon, 20 Feb 2023 08:31:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C5C96B0088; Mon, 20 Feb 2023 08:31:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18D526B0092; Mon, 20 Feb 2023 08:31:35 -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 098696B0081 for ; Mon, 20 Feb 2023 08:31:35 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C73BFA0452 for ; Mon, 20 Feb 2023 13:31:34 +0000 (UTC) X-FDA: 80487757308.02.41DD3AB Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by imf21.hostedemail.com (Postfix) with ESMTP id F361E1C0009 for ; Mon, 20 Feb 2023 13:31:32 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=F6aDLmmP; spf=pass (imf21.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.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=1676899893; 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=xq9EixHiZEF29J6CjrCCM63jzZCTPu7Pk2QffDbPEcE=; b=CWMNDCYOcefzWpShXxW0bMAoRhcZNIkgg4jaQKqpCD57HXzgbFN7iT5bfZGAzcEPuqai2L Oon2aaPlt/V67EUFtZ+uuyjhlyzQPI7kugUQElx0rI0Un4+6wXQ6i7R2F1Epz2dqcBLFuw Od77/OCIeNfUEEQ+ZOnSO0Rl9izTQuQ= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=F6aDLmmP; spf=pass (imf21.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.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=1676899893; a=rsa-sha256; cv=none; b=IfUld28g84SgZVUoPGIf84bvWrL7YJyGY1rc/vwWtfIQkcGGqdXqwjK4+wtfuQEN7SjKyC snj6RKQwhPlXyy8rRTeeoQ5j0Xz1Z6r8KSsewKoOoqlGuDx65TMWTZ2+1CsM3TbNZbKc/L IVtx9cmmHaWzK2fUmon8bKDMUvzuXlw= Received: by mail-pl1-f173.google.com with SMTP id bh1so1363429plb.11 for ; Mon, 20 Feb 2023 05:31:32 -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=xq9EixHiZEF29J6CjrCCM63jzZCTPu7Pk2QffDbPEcE=; b=F6aDLmmPAvfIdSKw+sxe4FUQMb5cOjVHYVGKAAMisyx3b2dt5O4CkTLy6COu6u1cZE gVFRsuAHCkKUyFUyh6ps04ekfGwsUIAfZE2XY0R3+BktoqwotZiTdLtr9eEB/R2ooL7Y iBLvXiGi6TSJCEOUDy+g3GLjzIuupNHtv1j3WFEaSow0afydIxisWBU3gldKlgR5YBoP irZQjav+MuUDtR0CiGVteOK6SEjlJ35YgaXuAHnv5tgD0zRgqCAe6Jpxo9rvni477Fjd +kX1tJgJ/WV/f3OB7H3msam2no6PBJf9n8M56kFYq5CFtYWORHXxFF66PMVCgKXmpPfc ISqg== 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=xq9EixHiZEF29J6CjrCCM63jzZCTPu7Pk2QffDbPEcE=; b=ML7A7tGtXLDJb+eXRauiuyvoMCq+EM8ctrByHM1B/T3K83VFMcgV1ycs8VBGt+H4un 4n+UBP2l7Wesa2OUtwm9TGeIHbVfYjhZKOg7Ztfk8vYe6WN/84eaPyB3YnYAsg9GQyF5 WNSMmbo9r6ih+8rarjPPwm85vivMRBlpyRN9H1L9MtbJJE56076aqwsmePe9rehADaEp SYYxJDI1pwo7UjNS86FKi0ZnxW3cqN2sUw9ti5uAeL4TF50RIHgoCLHcukJlxTSsr9bO TZkU7NkTOULTpYs1GXru7+GWrPhB9ioNMc5VMRdJIeloGxvMCCAZpuxzr8JfihfOvQCi dnvw== X-Gm-Message-State: AO0yUKVzrX2hsH9a1n0YJCmh3EUQCAihmxgqpewilv0YtcoPhC0SjQ1L mSbWB8nKxlSYzuNxJDI3WjcTGXqqADWqGA== X-Google-Smtp-Source: AK7set86eoyoWXdQNFcH37CcP4ECXadc86Qgo3+lcgutiSwI2xQGUmWl+RF9EDG2vqyIRqrKfUWmdw== X-Received: by 2002:a17:903:28c3:b0:19c:1450:886f with SMTP id kv3-20020a17090328c300b0019c1450886fmr427651plb.10.1676899421798; Mon, 20 Feb 2023 05:23:41 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:23:40 -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 25/25] mm/zsmalloc: convert {get,set}_first_obj_offset() to use zsdesc Date: Mon, 20 Feb 2023 13:22:18 +0000 Message-Id: <20230220132218.546369-26-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-Rspamd-Queue-Id: F361E1C0009 X-Stat-Signature: gkzba7j9wkgjk5fg1yq9ztmujhy9ugwq X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1676899892-885499 X-HE-Meta: U2FsdGVkX18E/UebUc1cWoBkF1q0sqr1dIW40aJFZU5irdipTXXNXC2fl4WeksdEC6NjYp6vOmA8tnjQ06fQw5lf98D8McpZLTt+Z3mO0PgkMeq4gxRzAPebDut08OkD5fSLc5RW0zMW7+WkZRggJ077JgFMwYtOWE38aWn/00WHLtTlazzBgVigPnLCdVKU5gp8ija2ZQyEy94VmSBjk5RA/8H7hPORND95kaq+wnXP9iOb964zncIAwkWFndnamT5PV7EKTHYxY1E+xlmJ6Wbs2VoA/VHzJ3LKbLOiSLdWzbO5JcQvlvMNMgX/i5FrxOUVDF69qqow5CEAD8Bye0cM5/D/yVNb30eW8utm00R7h0Td15LZlru1YiaxWoe5D1Oj6OW3K7m5rUoJLJ3J1aaBXXSTnL70D94XSiMAB0HG93Q0WjYttTg05bUhNO0AVBlZF4zm9gAjNC43FB3sPWfWXSO1ecLcoSJIUD8TPHasN9OO8jPV26ulzZwe5vj22hln9wYheISojUI1oYQi+UIwIpVwwazwMMMj2dkRc1bvwG6Bf4KotcW2isYCzFTbgIr9EYsA0gAg9JALtKOIrNMBFtXpZTL4OCQp34H+CJ3EKtCZm4DlT+paOb7dJOGKQnOxuKQRDp16BqhY3rNEUwevRxHaQdBzeg9an5r2ZH4noLpHO5y1c8SIqob8oP6gWo77deDFLz1MPqvMbH65tGdPDgMf86ak7D3EnC0gpvMJ/ROuotS8qHleSgtNZx6wfoOnYaHKocZKXH9U3bLBoVX8DAsqb6DiZhpeY7DRlIsvN0V2FD4V2XO700jjGgIJTYoMj1Y8fQaucmJqsfJUAXbAUrGN/ne55F3ttZR0GeWC1evlujNQqinCwJG89kZkt6omyoLs/+SqSFfQwYoD526PmpJztRFL2OOBhljFZxoMcofyAO8abWrJiMt+iIxaiyNSEBUPz7veMy5uTKG 1L7KfIPw g9vvMDEz6ujb9fpIu57mS0JRW/4FpYkX2EKUfI1AsYK6QFFF8Xq1ukGuV6RqL9zDge8YX8DIpk+Ta+1RgU93woBvDcx0wY2EgER24fb7WM0TYxiUndR8jNwI4j+2bC9Urc08+7u8OTA4Q6ufny5Hd8k+UD9DV/Zk20X/jnDGmknB6zFLqdnuTNZ9rL1etOC7vLZQibkaBedRvitFvlBPLItd2Br0LGE/H/OqiwRghy0qOQo2aEo10ot9+/XuH2jcxV+5aDCYpHc10M5zIlhgABEtoJmTHNhWcYszboy4MtKNlW9+izJQihHZRoGtoFPkRN6eyEv+UX4ekSQvAw5NkPiokaADlmFLo5ourNrZz+svCtc8m1t/bHHo1drwq9vkn6kIapQL5gkx5c1NjNezu6GfyK3KI/1VSG75ogoBLHm3JAtO6BZFrCFye4WVrCZCmHI/AOvHTJOb10lTCyFh0femAk39Na15amC/Drv6siWxG6H+FyOefxFJmg6BF6xTEDiP2UMfE4SffZILGPZE5QitlnNyH0qwD31/2RddFKKpvptTDFeG8hvxNuQh95Ef0/09Rxf4kkmY25szIYnncH1nvzxg+FS2Jz8aAdmhpoKM0iWY= 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: Now that all users of {get,set}_first_obj_offset() are converted to use zsdesc, convert them to use zsdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 59fe8d469aed..9ac72114e589 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -684,14 +684,14 @@ static struct zsdesc *get_first_zsdesc(struct zspage *zspage) return first_zsdesc; } -static inline unsigned int get_first_obj_offset(struct page *page) +static inline unsigned int get_first_obj_offset(struct zsdesc *zsdesc) { - return page->page_type; + return zsdesc->first_obj_offset; } -static inline void set_first_obj_offset(struct page *page, unsigned int offset) +static inline void set_first_obj_offset(struct zsdesc *zsdesc, unsigned int offset) { - page->page_type = offset; + zsdesc->first_obj_offset = offset; } static inline unsigned int get_freeobj(struct zspage *zspage) @@ -1192,7 +1192,7 @@ static void init_zspage(struct size_class *class, struct zspage *zspage) struct link_free *link; void *vaddr; - set_first_obj_offset(zsdesc_page(zsdesc), off); + set_first_obj_offset(zsdesc, off); vaddr = zsdesc_kmap_atomic(zsdesc); link = (struct link_free *)vaddr + off / sizeof(*link); @@ -1892,7 +1892,7 @@ static unsigned long find_tagged_obj(struct size_class *class, unsigned long handle = 0; void *addr = zsdesc_kmap_atomic(zsdesc); - offset = get_first_obj_offset(zsdesc_page(zsdesc)); + offset = get_first_obj_offset(zsdesc); offset += class->size * index; while (offset < PAGE_SIZE) { @@ -2148,8 +2148,8 @@ static void replace_sub_zsdesc(struct size_class *class, struct zspage *zspage, } while ((zsdesc = get_next_zsdesc(zsdesc)) != NULL); create_zsdesc_chain(class, zspage, zsdescs); - first_obj_offset = get_first_obj_offset(zsdesc_page(old_zsdesc)); - set_first_obj_offset(zsdesc_page(new_zsdesc), first_obj_offset); + first_obj_offset = get_first_obj_offset(old_zsdesc); + set_first_obj_offset(new_zsdesc, first_obj_offset); if (unlikely(ZsHugePage(zspage))) new_zsdesc->handle = old_zsdesc->handle; zsdesc_set_movable(new_zsdesc); @@ -2213,7 +2213,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, /* the migrate_write_lock protects zpage access via zs_map_object */ migrate_write_lock(zspage); - offset = get_first_obj_offset(zsdesc_page(zsdesc)); + offset = get_first_obj_offset(zsdesc); s_addr = zsdesc_kmap_atomic(zsdesc); /*