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/yVNb30eW8utm00R7h0Td15LZlru1YiaxWoe5D1Oj6OW3K7m5rUoJLJ3J1aaBXXSTnL70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PZE5QitlnNyH0qwD31/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); /*