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: 119514 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1582695vqm; Wed, 12 Jul 2023 21:27:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlFasqP2bJXENCmbcWZA9yFj/3OT+0xt+yMCdcMERhLsYKSf+ipZFgMQONMJtl65hjnbdJ16 X-Received: by 2002:a17:907:3fa8:b0:988:9621:d85f with SMTP id hr40-20020a1709073fa800b009889621d85fmr359422ejc.58.1689222463576; Wed, 12 Jul 2023 21:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689222463; cv=none; d=google.com; s=arc-20160816; b=mvbyS3arSxmLKxNdw7DGZkYUEGvStzIO33t7dZ7wlv7oFx3q2l4obrdGT/xhDlUnOB Fqns+v0X9uWcgvPruVDp+EiQoeOOPAfLgLX+LP93ZXk37nQah3cPWAexCctGr1Zdbw4v hp3ZzJF1afk/YVcvklh9mh43RtWvDhKNcWwkhu7axLqBhTSsn837+WwVaBtYo3Fpm+hh qF5nt82gyZesv1Y+t3iKlR1EVRsf5nFjEOHgnAsP9K7K7YpiE9c1JJ1Wt+mzfqI2iAhv omypFSlIU/gZwgqX9wqDSvL4RpJY0EA3Mbx1CMCoAoZrV3hUo4A9pY6+/gjrpj4xrXx9 9BLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KN/0UQ5A23ju1GQxKe5y1Dsl+buU4Kky6wfdVIYQXVw=; fh=/QsNaKhtZgVhH9aginPULJkva4OxUan3OolcTMonS78=; b=kWSQvEUdmsgOExHTmBQjJ+XUegFxzBDfI1hqMSTvCtSQYJZdSTfqxPXPvG+hu+cQ4C fkrmy3V29tQwdf03k3HH/7zhGgZagIeJca27L+FXwWw8s/c8SnrwQYZCJMzAIoVRB+MF mCG3U5apEJqfe21QiC2XM1eA9RT8kFDmTvNzlfFlqGziIHtAO2ZwJw7/Bs4Iy2ufEbo0 RPVaVbVPPJrieHXXjXbiQxi14iX2ZbaqPbJ6WtjuGM1C/ajoqrnkgguQt2HFatIEzKRL kAzUAynFTgAciA9wtYGcSEkzrh3GFoCwf2mnj/Ag8xY5qQDR2ib7vm9edMynFEotC9w7 Pg+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="QaglxJ5/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z1-20020a170906240100b0098e1908d573si6338692eja.325.2023.07.12.21.27.19; Wed, 12 Jul 2023 21:27:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="QaglxJ5/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233935AbjGMEWS (ORCPT + 99 others); Thu, 13 Jul 2023 00:22:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233860AbjGMEVt (ORCPT ); Thu, 13 Jul 2023 00:21:49 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 617F92693 for ; Wed, 12 Jul 2023 21:21:26 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-666eec46206so311195b3a.3 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=bo9BdbxYqn30GWAvDzdqWUfAxJEFB383lbzaPUBXfls3EK+OPv2qT33AZLphRhVCaB +yLPADfUWRV2FGBZYfskDkF6ySNZsJL1+CkFyoBo+RZjAQ5klvrCeEuHefrmOLFHLmfy PEZULKxXrLtlvw9XUbth4GYiRfXhZCU6PL+YRbv5488Fbr0pHvneCdU/Gdg6fGBF+LnL Pi5UQmG30kbcpd8wZmWG7rZvp/PNgzao9QpNp/3bqqj3EO1ZbxSjV551tYaNSF2fHGKb AW+HJTTWH05yrsJDT4BkvVTwGrTZcpP5PwSx65hCfsXG45UHE5eUaAgj1gIAf8WHKsjg QkzQ== X-Gm-Message-State: ABy/qLYvYJO62QflB1qaowuEOT+dmm9BIG7r0AUQ68Vu7u2RfyP28MLX OfRw5uKi6qI6mW06pnCA3K5eYGAZ8/QAhQBL75qkKg== 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771278133941950258 X-GMAIL-MSGID: 1771278133941950258 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; }