From patchwork Thu Jul 13 04:20:26 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: 13311275 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 6AF6CC001B0 for ; Thu, 13 Jul 2023 04:21:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E77E8E0006; Thu, 13 Jul 2023 00:21:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 04AC48E0001; Thu, 13 Jul 2023 00:21:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E062A8E0006; Thu, 13 Jul 2023 00:21:28 -0400 (EDT) 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 D24458E0001 for ; Thu, 13 Jul 2023 00:21:28 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id ABF291C7318 for ; Thu, 13 Jul 2023 04:21:28 +0000 (UTC) X-FDA: 81005289456.06.9AD8277 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by imf23.hostedemail.com (Postfix) with ESMTP id D5C0814001A for ; Thu, 13 Jul 2023 04:21:26 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="QaglxJ5/"; spf=pass (imf23.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.175 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=1689222086; 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=KN/0UQ5A23ju1GQxKe5y1Dsl+buU4Kky6wfdVIYQXVw=; b=IlmGT5yys9UdFRiwzAJOAXi+/jbmPDfce6PxmwL9kxifWpwPQYxE2vWY0+0EPlXAVZuuYX kOtWtDtys5fg45tbIjgr6E87cP6K/iNFqhQHWsFPyLit/2y5UVpabrDDyRsC1vVH8BJr3D nxotfwNrowJYy57v8fICHXxdaBBLRpc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689222086; a=rsa-sha256; cv=none; b=XYeWlUt9eo1vaFGK664Fg+dnNmRiKWWgJxHn7sWWA2MxsKJDC3OBb3xjbzZDEKxvKzHMix FENyYJDExgssgHXZyz9RXX7kB/bqrUxUOpsmXQjDQd4aO6DIR6SUW3xF97Knw6K7DpAgDk 68EguCODcWHsAiivcEHTvENHZhFf60Y= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="QaglxJ5/"; spf=pass (imf23.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.175 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-66c729f5618so324279b3a.1 for ; Wed, 12 Jul 2023 21:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689222086; x=1691814086; 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=KN/0UQ5A23ju1GQxKe5y1Dsl+buU4Kky6wfdVIYQXVw=; b=QaglxJ5/4DXjaQRW99wAX/gu3nfKdLqbbfoLZYjSPiZByNoZNuaSdKjd3TkB7SCXyb 9ehVOxCsLkwO4vuHp5ToaaXKVIGUzxQ0Xc9BVAejByY2cbduYp7MEgSHy3QXB14VaKJu /dQ0TVVhsehk0MF70CW/lmLy+DXRf72UlGYPhjyvFIavnPXAU9WS1TRF/1K5Tegr+t0I qYRZaVa02qwoX7CwbvkyUENFWVyK/X4roOk9f3PKyKmrpS0lq1ImDkXWV+rL6BZWGEta hyb+fgRMQ//JMKjUB80tVxa0Ad7ciBFGNKOG/gFD0rBbAhL4VGHGMzWqsWVYi0c10LpV wOBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689222086; x=1691814086; 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=KN/0UQ5A23ju1GQxKe5y1Dsl+buU4Kky6wfdVIYQXVw=; b=N3SX3HqsOaXcc9+B/dEOG6QUi71pj7eF36hB4z7vsrxPIZmQZ4CYo2oCzrLodyxdJY kp0zf6GyQaeeq0Egg6pYnHC9Wo8qoYWDDLGfwVliKzOZ0nn0M6SjRjjdR3+OGpduWj6c frahnIoxIBp/r7CAGo5oIiFIb36f7cbWltMkPwoyHJiLh1WNUspfHVeSgbis+bNLtov6 8IZT2OUIvfjdVkJ/hyGSiYNsh+BjdFnRVIwKMjtLmkMNaDEavVI9Ol92jvtitXEyNOKE hBDC0UcciFCMb7V40DPdEOuJ74z5a3UgGuxlpfNVKPfcOs+5KN2ttbAG0trAOswkZ11y T1RA== X-Gm-Message-State: ABy/qLbnBf0nRSVd7Q1hr8/u7x8osQLHCsY+MO39Cs6cvYFB6w3j8LWZ AfqfZ0sW+57Qa/Wtlx/x0Xo= X-Google-Smtp-Source: APBJJlG8kddUlSs/CeJcZNRjhBskayUfvYWIuJ8jWcHhX3qWsCgb/Vp6nYOC/llo4VEovjRzZW4bzw== X-Received: by 2002:a05:6a00:b51:b0:641:3bf8:6514 with SMTP id p17-20020a056a000b5100b006413bf86514mr775304pfo.10.1689222085708; Wed, 12 Jul 2023 21:21:25 -0700 (PDT) Received: from fedora.. ([1.245.179.104]) by smtp.gmail.com with ESMTPSA id u18-20020aa78392000000b006827c26f147sm4346601pfm.138.2023.07.12.21.21.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 21:21:25 -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 11/21] mm/zsmalloc: convert init_zspage() to use zsdesc Date: Thu, 13 Jul 2023 13:20:26 +0900 Message-ID: <20230713042037.980211-12-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: D5C0814001A X-Rspam-User: X-Stat-Signature: 8u94hdgbp8u9gpikbmcmdao48c48ukkm X-Rspamd-Server: rspam03 X-HE-Tag: 1689222086-943637 X-HE-Meta: U2FsdGVkX18waGn6UPDh0wAErGngfxYpurlJvEiIrQvGjVL1KPgHBDonSnRv/msQ17izTG9Ljo0gckUHe+/LVkUAkdIrBviNU5A/Jx/MY7WT7Z33ItFEcJIeaXmqa8ZIoPxfW5XNAcymnps2762F6VoOOUMFxOhKU4L/Kx9XHa0Yx36ApFICXqHxix5As293TT/bJdM9DxkeJ8Li8tSSYaldbvWdyi1Kc+hM0xHaLdW3SDvWRig484IVmseCynjUuG1D528ZDxkft7NHp4eYEkqrcaxu8aJ0hLOyeuG4HJFFV7fBk/OWo+R32qAOIe9PjAa+DTsOV85fNXwNKPQwdazNK/BaKC1J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Lw/GCyO/oHQQOGP5JgJnQU6r2CYpkBAr/GaGSoOgkvaGsHdhCxV7rtkJZKB1eTprECdIkRT5ZEny43QtaGctjEbKFceJuLwl6gOIdQucjThypueQt4uZb+OuGXK8ET6aObTlX3p3SJepnQ9sQg== 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: 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 efd7a0f78962..c8c3039a751a 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1048,16 +1048,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) { @@ -1070,8 +1070,8 @@ static void init_zspage(struct size_class *class, struct zspage *zspage) * page, which must point to the first object on the next * page (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 { /* @@ -1081,7 +1081,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; }