From patchwork Thu Nov 30 10:12:29 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: 13474205 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 E22FCC07CA9 for ; Thu, 30 Nov 2023 10:13:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7B8196B0464; Thu, 30 Nov 2023 05:13:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7690E6B0465; Thu, 30 Nov 2023 05:13:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 608626B0466; Thu, 30 Nov 2023 05:13:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4A3BA6B0464 for ; Thu, 30 Nov 2023 05:13:26 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 228AB12015A for ; Thu, 30 Nov 2023 10:13:26 +0000 (UTC) X-FDA: 81514208412.13.CFA950F Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) by imf01.hostedemail.com (Postfix) with ESMTP id 528494001E for ; Thu, 30 Nov 2023 10:13:24 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ViHEWkBJ; spf=pass (imf01.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.167.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=1701339204; 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=Kjc69aPDfRYct2ssOKqED0XUgPxt6UAzqNQ7B6cYebU=; b=RsWq1gzPnEjl85+PRZVrEm69sbEeqNzMppNqefipYiCfFHGNESi7kcAZOfw7rqf9mwWaVT Sknv4TrIc5eT4LzafTlCKkJnIc1+pjvFZEn6mXLg9hxml9llQ10BoZET9ggSXiOcUESIhw xbITrhK8Fs8SOrWH743GwTlKxofCfNU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701339204; a=rsa-sha256; cv=none; b=VFfNQRxZbaaatGWf/98oRDML6Y9d2a3566HNnEN+MfLmmhFrQhK9Fl/JMgWfgZGmaG7Amf p7TWStSYQEciXDnWugUIdlRDbYzM/z5juEahx0D2VHoXh3RKlHgY4uvqv16phsk49/bhbA qcCvoIqEeqWEGfp6GkHNrSf0QMmfDlI= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ViHEWkBJ; spf=pass (imf01.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.167.173 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3b845ba9ba9so435911b6e.3 for ; Thu, 30 Nov 2023 02:13:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701339203; x=1701944003; 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=Kjc69aPDfRYct2ssOKqED0XUgPxt6UAzqNQ7B6cYebU=; b=ViHEWkBJbyAiSjes770OzgTHPRTYQ4RJVc9JKZCWLcb+uV2FpcBrhTY1v6EVxnxlhN 4v6/hMTcuL1G3YJVCH7LXLgrMorc6UOMAdgTrfruWJQdbaDbA1616hHYG5wU+JOL3xP/ BGeDoAJzTCKS7SMYCKHEaUaPX5B5spHYTmXApOp1coHsM8PWpkHlWPPn7CzlUzkHhjBO AtggiEhPJZcZB1DC4Utm+Pcpo8V9SD79NnWFaqTMKiZHlCTVKl/AoDC36Rm38V3kEpJ/ GOpJ+r620es+80iCaBqak3vzMM4l4xCKVEkCQ5axdKaJ8Jgi0JqHlRqT/L6K4SUEcIFO M+HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701339203; x=1701944003; 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=Kjc69aPDfRYct2ssOKqED0XUgPxt6UAzqNQ7B6cYebU=; b=IFWKsv/B4+PngSP5Y80epcF5YJpE2vMQeBa1pwHbCOkpHP755w+q2QRm8hztNPwyit 21DKYV5Yh3ZnPv/nvDTAmG75sOpoOtqOUuy47KUsM0uwIP8V0C7U4MrFcjYSaOhGpwLd EV+x8LOkB1OTUpZIx1yffI7CdX+j7oklDdTik4Ix1cLYRg1lJw2e/QtWb6inSwxD2SvP bL+/DS8IrKnyMm54SJA18Pf6TduHK8SeEGkky8uZFvI/3fCsoui8V9nbYDUIRlGzR3aw WtVscwTAwKNrurP0oQln+upX0gz1aoMmW7TkhzM0FAfnDAnVcJwUTuzrbw4rXt3LXziS ryAA== X-Gm-Message-State: AOJu0YwlOMZqkRqUjd2g1QOqmuSzGW17rTPeWJe8TWP33DmXyFGgwZjE fxfBjLuKZSp4gLqIEWbnA40= X-Google-Smtp-Source: AGHT+IEWkVmBU5JkEIZWnFyE/VXLr2LB5Fw15ND7dNbbGbUYfuhXURtapglhyxY9Nfd4s11kLj9D0A== X-Received: by 2002:a05:6871:e7c9:b0:1fa:306f:60d with SMTP id qc9-20020a056871e7c900b001fa306f060dmr21590218oac.4.1701339203405; Thu, 30 Nov 2023 02:13:23 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 02:13:22 -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 08/21] mm/zsmalloc: convert obj_malloc() to use zsdesc Date: Thu, 30 Nov 2023 19:12:29 +0900 Message-Id: <20231130101242.2590384-9-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: 528494001E X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: jcpzhmpzg4mg5pzpohz68m19pgq9h3wn X-HE-Tag: 1701339204-109657 X-HE-Meta: U2FsdGVkX1++xGG//kRsWjImkYsCevKf1tQ4seGT0ZUlspFH+QTOLqpOUu5spMVOvOHKlUYUuPIyrG59aQgWbRcdWtYrlF4hCksH8GZ0jNEoxV/0CTWMGe8nQEssO6s12a72xCcJbZTEcMsqrMfR6DZw0d0ShSA5nhV9XBDBYrPim4XX1m8jUg0eWuTK7s/k5vOui/cgKnumPcxS6g6rmmSetTgpgobg5RI4tmqL7kbDyPFVdICT3gB5NsI2r8uc6XY0rMRlyPWIfgbowzQQqQjtH/lKkAcaeB4WtagaCoNs4vSjYGS3jzFaYDbVVvGRTlRj+dKhRRIQzSxJ6IA9cIeku3XizQSq7b+Rt56b2isNqn+uJOY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eqmpViTD+s5KQxOGV55izGcAqEoj+dKebfis5e+0QCPSKSxQSxzxvuA3YTyZd9qBuU+GlzcolEB03qU6foZYtAj0+q64L2oFAcpyVdgxnjjnG/PYMf+FPs7CdoaVBXsg== 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 f5a20c20ec19..74ed0477f40e 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1416,12 +1416,12 @@ EXPORT_SYMBOL_GPL(zs_huge_class_size); static unsigned long obj_malloc(struct zs_pool *pool, struct zspage *zspage, unsigned long handle) { - int i, nr_page, offset; + int i, nr_zsdesc, offset; unsigned long obj; struct link_free *link; struct size_class *class; - struct page *m_page; + struct zsdesc *m_zsdesc; unsigned long m_offset; void *vaddr; @@ -1430,14 +1430,14 @@ static unsigned long obj_malloc(struct zs_pool *pool, obj = get_freeobj(zspage); offset = obj * class->size; - nr_page = offset >> PAGE_SHIFT; + nr_zsdesc = offset >> PAGE_SHIFT; m_offset = offset_in_page(offset); - m_page = get_first_page(zspage); + m_zsdesc = get_first_zsdesc(zspage); - for (i = 0; i < nr_page; i++) - m_page = get_next_page(m_page); + for (i = 0; i < nr_zsdesc; i++) + m_zsdesc = get_next_zsdesc(m_zsdesc); - vaddr = kmap_atomic(m_page); + vaddr = zsdesc_kmap_atomic(m_zsdesc); link = (struct link_free *)vaddr + m_offset / sizeof(*link); set_freeobj(zspage, link->next >> OBJ_TAG_BITS); if (likely(!ZsHugePage(zspage))) @@ -1450,7 +1450,7 @@ static unsigned long obj_malloc(struct zs_pool *pool, kunmap_atomic(vaddr); mod_zspage_inuse(zspage, 1); - obj = location_to_obj(m_page, obj); + obj = location_to_obj(zsdesc_page(m_zsdesc), obj); return obj; }