From patchwork Thu Nov 30 10:12:32 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: 13474208 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 BBD98C4167B for ; Thu, 30 Nov 2023 10:13:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FBDC6B046A; Thu, 30 Nov 2023 05:13:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 480E66B046B; Thu, 30 Nov 2023 05:13:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 323928D0001; Thu, 30 Nov 2023 05:13:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1994D6B046A for ; Thu, 30 Nov 2023 05:13:35 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id ED96EA0128 for ; Thu, 30 Nov 2023 10:13:34 +0000 (UTC) X-FDA: 81514208748.03.DC0D06B Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by imf25.hostedemail.com (Postfix) with ESMTP id 2675BA001C for ; Thu, 30 Nov 2023 10:13:32 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=R11RO2gc; spf=pass (imf25.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.171 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=1701339213; 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=8jWeGi28nfNGy4wvNOSN4A3IkH18ay24ClD0Q+DNHkQ=; b=TTvZzoIoI0R5KWXD/kvmOfgDwNSZBBtvgcBGq/V7i7bmznaFHRT8JMydj5g/p0h9CUu2MS E9xjW1rPNzVNV0ZoStaaQu3kpB06KaI5LT7BgXhIkAHRRuc2iprDMr0klTq7q6Kn/ypCaL TX76XdvUbf2/B2Hw6JxKVqgCP/8RB5w= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=R11RO2gc; spf=pass (imf25.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.171 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=1701339213; a=rsa-sha256; cv=none; b=QTi04Khzax4+Nd8mQDuvrj0Q6qYtBi6McSSThmj+ZsKN36E8gbGuzvbypbbre43gthBIm5 B6so5ot6SJBKGbc7Jvw+Ve3aWq0xBr02ebisJw4stgAkX7PxESLykleM6uBv94GouNhLSI g1HL+SElNad8SL8PLQpcdJkFO6O1bHI= Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6cdd214bce1so749598b3a.3 for ; Thu, 30 Nov 2023 02:13:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701339212; x=1701944012; 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=8jWeGi28nfNGy4wvNOSN4A3IkH18ay24ClD0Q+DNHkQ=; b=R11RO2gcPLP06yGDCgwtTQ6av+fALaoTB73FwEkDfA8Ft5BxsuYw0t/v0GTd0toC9S 2r5UNIoYzlpx9EwDcv7QVzpg6c5gntO8XtMxg2Wxzc+Yii3Fxzbb6S7VsvPIWTpEvE6D trEahjQra/3i3Gdbh7m1N8f7ydZroj/bldS5aM+hMIsauNkMM82wyRtbz7Eb2PMWRyAQ L59NpHdGNW8k8TZqKHmcxPOsVV2b+Nod5me7lnAqPHe/24VtqYde1M7oksR+3PgrdhL1 9s9EpD0mMN9lgQBwrm5GNiUUEeGpoA8o3gYr0MtZ1sqFQ+jtOGQMOMLtz9uD2WRF8i3w RAOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701339212; x=1701944012; 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=8jWeGi28nfNGy4wvNOSN4A3IkH18ay24ClD0Q+DNHkQ=; b=bG7ACurRr3B/FK3dhoA8OGoNfznXV7R3aLQjsqFYvBf09xscFJmA/dvn+FG2C58wlB IF8vs3ALHpMhgfYCEkwFWKo4DjZFm6+06cX0fKXzcrWhcg4fwJe9wrAG7jwQ2UWr9D4m S/yzbKahYVGM5lvGFX28c9dP8RdG+6R1hpQrNICwXZeF1817AQokUxa9H7LYXYm/xM2w b0/bgZycTT5qtawF/51X/vWXVMR4FlMrs1jiCIUuzth6xnd1NdHtMouM2cgF8hukcu8s CnRw4zE0KFipcWl8hB+5oJRGSuZZM7cClSt3unIfcPE1qcvF6XRGybs6zLAFFArlHb3U tRTw== X-Gm-Message-State: AOJu0YylBrcnrfzq2YmSZqz/GhcfqBWRtNs6QlWd3OzKayMQe6ww551q aaqUmI/hgfS+XrlzPz8kakk= X-Google-Smtp-Source: AGHT+IG5pQEbla1Kb8DJw51iiB9xJFHgIZQTEhcTpEJwyv9qKXaA4smwJQqouZQCyjNQGiNxCnUKtw== X-Received: by 2002:a05:6a00:1d83:b0:6cb:8d97:3df3 with SMTP id z3-20020a056a001d8300b006cb8d973df3mr25523758pfw.5.1701339211946; Thu, 30 Nov 2023 02:13:31 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 02:13:31 -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 11/21] mm/zsmalloc: convert init_zspage() to use zsdesc Date: Thu, 30 Nov 2023 19:12:32 +0900 Message-Id: <20231130101242.2590384-12-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-Rspamd-Queue-Id: 2675BA001C X-Rspam-User: X-Stat-Signature: 15pj3de888canp3brz5x7innuo4pipf5 X-Rspamd-Server: rspam01 X-HE-Tag: 1701339212-460027 X-HE-Meta: U2FsdGVkX1859MP9r83S/OchFoQE7T06EV3377TzqwTovzTj9MmVawgyE/7j4gDNGZV0BRzuEmtWHfOb32wvRz31DcnjqJ2590TI7ZL7V/O1v/Hk5MKzQfCc9hJndDkSPlfk9JzUy+zU37f3z2wrna7Wnamf2vRpPBnW+fKWR5pWJHsc7BWHhJfp8amZ9y8KwMVGukIOqjbeBsnvcSJObpLcaAwOJIPV7RXfbu4+4PPjykbk3ZumGNA6GN3/TqmsoOMxzqMpGd3pJP1h6HCBVsJN/LqwwBVAMBSy9r+izmJdv5tenOdCWoMfEMfjPqYPNU9QrZdnfE2e+8yZgqvnYDRBOgIm21pbSfzNr4jwL4n6grLXhir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GvufATIcNmjwPSyMyLdzEhYYDT5fsWin6J3jh6Hipoft/EeP75jpoXSG2SF1sS4istCVq6LVE1cY/+t3DF7dO5YmN677magFDbvWl1jCAqoJ5GLdyJPn6V7gAYvGeYPh5tTdzq9+dk4oM3uePhjEtW65HGlWxZeWvhw== 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: 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 f625d991bab1..8fe934df298e 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1052,16 +1052,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) { @@ -1074,8 +1074,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 { /* @@ -1085,7 +1085,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; }