From patchwork Thu Jul 13 04:20:36 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: 13311285 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 38D74C001DD for ; Thu, 13 Jul 2023 04:21:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CCDDB6B007D; Thu, 13 Jul 2023 00:21:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C585E900002; Thu, 13 Jul 2023 00:21:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AAAE96B0080; Thu, 13 Jul 2023 00:21:57 -0400 (EDT) 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 946D86B007D for ; Thu, 13 Jul 2023 00:21:57 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7586D40010 for ; Thu, 13 Jul 2023 04:21:57 +0000 (UTC) X-FDA: 81005290674.17.62E911B Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) by imf26.hostedemail.com (Postfix) with ESMTP id A28D914000E for ; Thu, 13 Jul 2023 04:21:55 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=jiG6Jx8v; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.167.179 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=1689222115; 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=9MetfO9mrNUCPlQ/wlpQAjWG2Omnt/Jwf7TCm8Zb+zM=; b=xVNHI6KzUSieBejNOV9A8BP9EZUBSzPayfjTX4pBNmMtDMfcaGlOXgV18oCClMFjLyiXOn YYIwsr5zeEmbMA3yMvYld84+QhEp/kU3Bah/RYK815wdv187A4nHtDiucwfsDLkMaXg+uf 4sUwHj5EBg0kvUdWlKyVbg1pchXfgKA= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=jiG6Jx8v; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.167.179 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689222115; a=rsa-sha256; cv=none; b=ktbOYi5L3RgHklOAKWHJsccZDK/SojZpL+tkSbCNUAvVUVF8hLlr/JUwz7kgIlK1wHTNgE LM74gPXqE+G+CqQCYHiaWMlqausdfdKZ20/5S99mpt4uxjKhhExQFI2urVtN8X/1HmnFzq 1Usq4tLKJ4owuizn200nfs+QWQyNunE= Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-3a1ebb85f99so321654b6e.2 for ; Wed, 12 Jul 2023 21:21:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689222115; x=1691814115; 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=9MetfO9mrNUCPlQ/wlpQAjWG2Omnt/Jwf7TCm8Zb+zM=; b=jiG6Jx8vCgsZyWAXe3kUGl5Upako6/0pIT2NiUYxygtCnwxrcoeYsPV3i5Gcl5cn2t Bzlf8SSWF8qrdn0f6obQVsRY5ZP7XeiJBPkpH3tvqKSyZPX+hgjuIywu9/nb0UHxSlrM +t5R51ZUMPBPupiQEifFHmBUsv7jqUbvokHGWc8YSWLZ/w8v6wzdSugebG2dLgAC2fTR gztdBFEUkKIoFlpMBPGExShJppDw7+m4z8MBK9yJKnpWGCzRKA2L+50cEp801RXqbY7O ze9c6SdR/EdhnVbqyTexU4Xl8Iqju0TNwJhDPsExbp0wBwSXAFj9+GgZHHn/67yFKj0Q YajA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689222115; x=1691814115; 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=9MetfO9mrNUCPlQ/wlpQAjWG2Omnt/Jwf7TCm8Zb+zM=; b=QaFh28lbR3kotW6x+iBThHTKdJ3S6llawZVMOvMGCaRxsNzEQ3PBAyeCoVPaSUlt2p cqyviEZdNTM/XH6GpTCfPfLxFcN6VDrIiSfOyPpoiel6HEFIwyyai4P32+5+l0gv4QHd ttmlcJ5RaFOg755BpIGB4fqeD2+OgBgGvXHfjqYovuoSsRYr3xM+u3IajZtY+iW0utOy IbZjst6q5LFUptLJRlXFJD7H8kYMqD4B0G3FJQlKKmh9cd5IMKqwQFLGhVQo44AQiTOP GC9aBeyIS7Qj3fHG2lC0ohaBlcXANtgpRVpcI6u0IrPCu0uAdsUZ/ZGyWRH6dgtY7DZ7 ToDg== X-Gm-Message-State: ABy/qLa/aE+cVfBYuibc+JOY2PLPIKG3a5KYck7RtnlImQmMQx4q5qUX m9uAcvR3IcjNqTm+TugKBuQU60cpCHGHoQ+AwUM1Zw== X-Google-Smtp-Source: APBJJlHRPVrgCMfgSTQjztNxsY5F6JRQM00POfBtGVR98CC+mRl/WjJQjXMYh+PyKxa4hTDWDnelOQ== X-Received: by 2002:a05:6808:118c:b0:3a3:7248:252a with SMTP id j12-20020a056808118c00b003a37248252amr904978oil.0.1689222114767; Wed, 12 Jul 2023 21:21:54 -0700 (PDT) Received: from fedora.. ([1.245.179.104]) by smtp.gmail.com with ESMTPSA id u18-20020aa78392000000b006827c26f147sm4346601pfm.138.2023.07.12.21.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 21:21:54 -0700 (PDT) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Minchan Kim , Sergey Senozhatsky Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Matthew Wilcox , Mike Rapoport , Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [RFC PATCH v2 21/21] mm/zsmalloc: convert {get,set}_first_obj_offset() to use zsdesc Date: Thu, 13 Jul 2023 13:20:36 +0900 Message-ID: <20230713042037.980211-22-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713042037.980211-1-42.hyeyoo@gmail.com> References: <20230713042037.980211-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: A28D914000E X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: ynqxnyxmyony5k38o6k55ygbqr5sypip X-HE-Tag: 1689222115-56897 X-HE-Meta: U2FsdGVkX18+M5N2vBBis56CLk8n4eFwnfGAZLhTIFFjgN3UQVc2uczxylTPmI+LzDdP+VhaM4wooi2z9UCBP3W9DV5sZsMqFTItPmYnNTwFb+HXhF2Hv1CV5kcYovWPbaW0hERpFPjY1MfOeuaaDRgBGcI1oSmvB1I2urXjmi3wt4SRqVPnlYc0zTjsDV9fPag3f4IyZ/HGEiaAN9ZmeJ+1niV3iWvX3K5eVAHnkcML2xBtbGxN9TYyk2HhvS4ntddAJpfkKb0pdvXk6R/NFAlCt1lsTi9vBO/D+pJhRTQWVwe+/W5nZO7yZtM8B8puN6KiR5NGSJCZx1P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v+ZzhDYeIdzz1zef3CBzl90ASerbSimmyCWsp1yDOFeohn5MZdF2oAGgMsXeXdTJ30lfhR7f9B7Qg3Xz3rS3jvLa6xUcEip1a0ORT17lA5YB+KnvDQxfRsFzorRvRGGt3h6LrwRf55eURgoFdXD/FNxiOl17LeCF82p1hEWZ/Vt+f7OfLza1sJ2lJ2QElw== 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 3933c023c3c9..7ac5d63e10a5 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -606,14 +606,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) @@ -1049,7 +1049,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); @@ -1699,7 +1699,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) { @@ -1910,8 +1910,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); @@ -1975,7 +1975,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); /*