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+CGvUGU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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.