From patchwork Thu Nov 30 10:12:42 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: 13474218 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 F08E6C4167B for ; Thu, 30 Nov 2023 10:14:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A4CC8D0047; Thu, 30 Nov 2023 05:14:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 853B28D0001; Thu, 30 Nov 2023 05:14:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6FE718D0047; Thu, 30 Nov 2023 05:14:04 -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 59F218D0001 for ; Thu, 30 Nov 2023 05:14:04 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2CEB18016F for ; Thu, 30 Nov 2023 10:14:04 +0000 (UTC) X-FDA: 81514210008.13.18AFA09 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf16.hostedemail.com (Postfix) with ESMTP id 5E55D180007 for ; Thu, 30 Nov 2023 10:14:02 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=AFt7IJTz; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.170 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=1701339242; 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=lyPb56hbhEM/FKv+hmpEw5e8ZouRuLUTuexmLJPMtQE=; b=FpuzZ762Z6YI9VIgo4KVtWC4LmenuZgIKIE/vtBqUfIfsiMn9NeA4Xz3ffPL4NT7PJjSts zcXVpqwqO8imLRdHVKKpMouERfwRf8r8xjyUjDek3N9JXNPasEbDslLXfWC3Ud2QsLQKNf qF8RD92ZrFIFRpO7kLl4OXMYSRpneLI= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=AFt7IJTz; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.170 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701339242; a=rsa-sha256; cv=none; b=LIUeFCvcV6Nu0srlWG/oGSZ6XyFvmb3JDxadx1kAOaSnVPP68QglzjmveR+PLOO0JDYZK7 VraeN6BLzqIJYprDaw7wwjQXX/a6nPxeJPiIHMbrfirp9TntvV1UGV942vqnx5LDTNzzBI 30e+ohqVLuJ+Y394bdUSSCuXbaYnImw= Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6cde14ff73bso698723b3a.0 for ; Thu, 30 Nov 2023 02:14:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701339241; x=1701944041; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lyPb56hbhEM/FKv+hmpEw5e8ZouRuLUTuexmLJPMtQE=; b=AFt7IJTzc281eWeyyS+G495L6pJWieFplUVajylU+sK1LUrFC7qFdsaQUE9x9BP8lP d3J+xE2fpr0xCoMNSPpmTv6l56NOzhxpimbqBz94FALG59CftilNZo0xf6LXiIfaFPZ2 9Vxj4+rb60XIDZieWtl7wB/NPOlWfWb0cUjJIGPuKJcmns8aewVK3jniDQ8TBt89ljcn yLWO64cevsKoBFFtUMwoj6B0TO8epo6eWzmQD00tD0zx4nmlNcM5TLI8rxax7eu4CT1y ANp6ZPXk8zxWR80mLzTqGxgRSX8fpF/7/rZeAgfvRqkYOgjtls54wDZVwPIdWuL4lq21 l1tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701339241; x=1701944041; 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=lyPb56hbhEM/FKv+hmpEw5e8ZouRuLUTuexmLJPMtQE=; b=pTXEt7vp3BO9bGFlh/1bTGWzKQJ82xvFXmYJWChKjv+tI0y30YjyruyK6d148vPx4i oYgkPus8sTOwdPwlGdum14FESib61eVxh2F65D1Fp5ScL05U0+b55INSUISJFauv71LB Znlwqp3d0lANtkAFLWp/U67u0C7fV/jl5EyOBhZr/Hs2qer3VCm8DySB9YcdF+ljwuhs VcERx2qTY7iw5erN5UnIxdR+ZUkUhTi+qalN+o3+EGJyCz8V/I6QRQHbsxz636utdA3S gGWzXaW1wcMVqIPN+OaAdz1FfjSHa012yWL1eUUaqT+pwIKajnypzw+KFpAShiPaK0+v r5wg== X-Gm-Message-State: AOJu0YwPazyTacICiJObXA5wuDACl1KlQgqeqyXW5Ko+ZUe1d6SxK89u HSTWOLemuw7vljugsnNqZ+0= X-Google-Smtp-Source: AGHT+IEdZSW5j0wezUu2q7x8ocb5tF0F1aps8c4SQV2R23kMFh/ey419QmoRo4rTRx5jIHOWJ0JPKg== X-Received: by 2002:a05:6a21:7886:b0:18b:8136:f2d3 with SMTP id bf6-20020a056a21788600b0018b8136f2d3mr31762705pzc.24.1701339241118; Thu, 30 Nov 2023 02:14:01 -0800 (PST) Received: from localhost.localdomain ([1.245.180.67]) by smtp.gmail.com with ESMTPSA id r27-20020aa78b9b000000b006900cb919b8sm841402pfd.53.2023.11.30.02.13.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 02:14:00 -0800 (PST) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Minchan Kim , Sergey Senozhatsky Cc: Matthew Wilcox , Mike Rapoport , Yosry Ahmed , linux-mm@kvack.org, Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [RFC PATCH v3 21/21] mm/zsmalloc: convert {get,set}_first_obj_offset() to use zsdesc Date: Thu, 30 Nov 2023 19:12:42 +0900 Message-Id: <20231130101242.2590384-22-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231130101242.2590384-1-42.hyeyoo@gmail.com> References: <20231130101242.2590384-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 5E55D180007 X-Stat-Signature: z64jha35m7k1ifn4jb8mmq6ucxhpeufk X-HE-Tag: 1701339242-757101 X-HE-Meta: U2FsdGVkX1/jH7yRAcEWqCpv6YTQt8zl876ZwwaBGPLnxuZW8YwiohgtaPbmceyfKYlqRHie3/mFOYHUYoMJyn/WUBEZFZMoO21WA9uKzKQlhWGLOSH5n3U3Mu10lt4XZ4hSaT9YSnaewVcHU1IxPws6MZ/zo7mOJXLDCypabKKbh4rOdmRCGhCsUNymLIUwMuE12bLINaod+eVeoeF151sYeGUqybyxXgmz4WW0hwmd89flP/oIUbgtu1Vp18XPwOQFpiOhBI3YfxwmmOeDoVg82gz980DcFT8JWJ14b/OR+PQE0/VVq6DFbuztY46+M6keydkPrd0L4d2bDkkRdp0n9aS6K0xhRK2y6VVMX462pXk0QnDgM4G/mPEEr4F32m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L2OCaMhJ8zbZGIOc9Cd6arvDOtwmqbOJ/cxx4rXoRNHlGUkbawxQ9ObGCuSy0HJouKN/c6fjlvXG+1VXEtevJg4FXMN2x1lDt7Ny+aS8yaAeTIyS1Kj3bU7oeUdA== 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: List-Subscribe: List-Unsubscribe: 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 65387cd4cc5d..0e1434f8ecdb 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -610,14 +610,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) @@ -1053,7 +1053,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); @@ -1703,7 +1703,7 @@ static unsigned long find_alloced_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) { @@ -1914,8 +1914,8 @@ static void replace_sub_page(struct size_class *class, struct zspage *zspage, } while ((zsdesc = get_next_zsdesc(zsdesc)) != NULL); create_page_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); @@ -1981,7 +1981,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); /*