From patchwork Mon Dec 16 15:04:36 2024 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: 13909883 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 2B46FE77180 for ; Mon, 16 Dec 2024 15:05:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD1046B009A; Mon, 16 Dec 2024 10:05:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A598C6B009B; Mon, 16 Dec 2024 10:05:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 884586B009C; Mon, 16 Dec 2024 10:05:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 630CD6B009A for ; Mon, 16 Dec 2024 10:05:27 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 23FC51203D7 for ; Mon, 16 Dec 2024 15:05:27 +0000 (UTC) X-FDA: 82901144760.13.5A43DC3 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by imf18.hostedemail.com (Postfix) with ESMTP id C9A771C0004 for ; Mon, 16 Dec 2024 15:05:11 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cuAxtTux; spf=pass (imf18.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.179 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=1734361502; 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=kwR4Kblt9I5wGNH91Yw49hgsy/SeTIW9WrJpJz9IUNw=; b=WeKXeRSV/Ce6DnOZMwEbX5C0CiDmgKEtucIo59uiNWv3UYWIikwOm2e+1k0fGRwIUGKOV7 7FcSu8gPhqR8b8o9V3MduEkoBAd7yp25MGD5iIIGBZMKpZa1NBN3ePZaRsSGBLZRJ5cBDN 8QVJJyTvbCWSJavR5yDsNSxwtpCdKcc= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cuAxtTux; spf=pass (imf18.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.179 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=1734361502; a=rsa-sha256; cv=none; b=tg6kWfH/JR19U8sb4L4q9n36jXoo7bfMv5YOfIenhgRbpyHbwGcYCNZLfIw7i2An7bcyg1 lKQtASKXuNbwm+xn2ytPD/o2d6MF8CuFZonV/WESHbKzs4l77nZUP4m0zW+N+cMomDNMyb /vq3S8AIpE+666UzeVf7ALwp25tUi2Y= Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-725c86bbae7so3496468b3a.3 for ; Mon, 16 Dec 2024 07:05:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734361524; x=1734966324; 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=kwR4Kblt9I5wGNH91Yw49hgsy/SeTIW9WrJpJz9IUNw=; b=cuAxtTux4UaMEAbTWhGhnJAKx+Frk0aXeUyOWEPtv1UpeCfktJd24yuKYlln2K6h7T CFtcPB/wdezu9P8A1eJtyU+/SDM4qI+pWJSOdsyaNfYFNJsi9ZJX0zF1r6J6RV+XWK/H 1VJDZhbBepPOODuKaMh0hDC9yyCbRH09ZXg0kb/0MRrFZUXpyc51EDDyGGL5qm0AdcqW heGlNxZZ8nu7PeaOylOFVqBV/yx28OcSN/8KNnBUm6ELz5W5/okvgM+S5j3JYehP2+vv ydURCHCFRafpfrDfs62kSSCWoEhnzDBZ0hytnTVqwfrLeX5+g3UjT1tfksLMH/RmCNzp Ky7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734361524; x=1734966324; 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=kwR4Kblt9I5wGNH91Yw49hgsy/SeTIW9WrJpJz9IUNw=; b=vY4X1nQ5JrML2V1aww4z6py2FCrr4jiEc0Gq7KwxqWYXGIF6EJnOO258ao1ZTzVUhs kYe3frHbev2dpvM/fETfedwOgheVckXqPANiQhzHjBYrmSLAEBjfU481AtiYf71k5nFX 1rbq9PH/0W61hRdk3uSxwWTGftbOV9BQ4teIFxcjRxX5QWvfimyoG/bpXArjNbZr1sIQ 43hxUsVWT4+S2J6iL4w3kNBPG0CCCsk6YE38F0Mqi/oqql8ECnXfdzw6bhOhJKdfHyTt 1UJ3Tpm29CtSqwSgUbzQkXPO18sAO3aYKMwRwwc/HS8FMoIL3VekcEDHGcRtCNz3sqUo y1Qg== X-Forwarded-Encrypted: i=1; AJvYcCWJvyMRkM8stJRNQYAiJtTZnFV/e+gTf+FgzxP8IctE9Z/ilL6q7gw4WycGEcZSpFXtZvPDbB/MRw==@kvack.org X-Gm-Message-State: AOJu0YywUZAcRzOL66aW3/gPw9Tnb9nOiwJ0NHwI3EgkekqT3Rjf5l05 c3pHsGC6fHH7Dx6Y7272sSUuZo3zD/uJa4B4yo6EppTKthn+R0Ld X-Gm-Gg: ASbGnctxtc6kYjVprTLfF67W919TXd+7aAAHcd2qpafpezeiVawndBwIRLrRtCWbcxD 0LsIuk8RjtpvJp73L7+xqYayp7JwshYB+EHyD20kUPIW31X+dUyXYib1QAS3678b4xDcW9hSJv1 FTS+5qfAF74SvtZH8JPfU0MVIhEm274KWe/7bdVjUrvGkD9/Up7WBXG/vgVox3px5FVVgW/yUXr Kzqc9cH3Cm8prTSQztyoZIQKuhId066O2NCmJPwvbRgmFCcVxlKP9sUtMo+KvqIqg8= X-Google-Smtp-Source: AGHT+IFdtXwULYpLfCdhZkikdihqfVSBIdLhwsM5YoIBA2XpOycR5dSAkcx2Y7UFlJRvJkhs5EQ+Jg== X-Received: by 2002:a05:6a21:1796:b0:1dc:bdb1:349e with SMTP id adf61e73a8af0-1e1dfd3ea3fmr18992894637.17.1734361523658; Mon, 16 Dec 2024 07:05:23 -0800 (PST) Received: from localhost.localdomain ([1.245.180.67]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72918ad5ccdsm4845518b3a.74.2024.12.16.07.05.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 07:05:23 -0800 (PST) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Minchan Kim , Sergey Senozhatsky Cc: Andrew Morton , linux-mm@kvack.org, Matthew Wilcox , Vishal Moola , Alex Shi , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Alex Shi Subject: [PATCH v9 mm-unstable 05/18] mm/zsmalloc: convert obj_malloc() to use zpdesc Date: Tue, 17 Dec 2024 00:04:36 +0900 Message-ID: <20241216150450.1228021-6-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241216150450.1228021-1-42.hyeyoo@gmail.com> References: <20241216150450.1228021-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: C9A771C0004 X-R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 lAHJaxSJ mKE2nSNIhPLWARdb5WGnYLej7WWZK7WIwYLsy06cTHkVfG9J9lOcozsD13kZMC2fbXRR8cnMHWXWEoFP+bOS6CljjoaddJaYRZo1PcnEX00Xq7M2lE2RptESETYtXlw+kc68LEfsQPDCUJvBdCFL3zJdvRwc1efGa8vj1ls5+o7WTesX7KqcxXICwv8O+tPcW/3IYh3KdndwBV7NRT7+y0H4T7ACt2ftg66dDlMrPmK1unMaMcXQ3sYD9kjdxdZZPGN9ou0avnt4SKt0eXA1vnmc5fMLjoYCABEU1foK417aG6s4IYNdd8V29TtQUzmJg0J+xletodcXh37GBMltRN9PrjmOKQlKAIa5DTME00yFesFpDF2jNOsp22shoMFCZ28l6LACINYOfNNyv8zFmHEYCOdTlwoPTMb/wEEx7xb+v+wyt1lpkC6XhOXtKLm7jCIj0THCraFLOkUBEmK1MWAxkYypYZRoEcLVBz2pZVTD6GILEc8QhH+3jMehKL4IiThpMCPSva7P+RshZfxAMQrkAGmHH1HfonKIBoVkIELv2WCs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.428842, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Use get_first_zpdesc/get_next_zpdesc to replace get_first_page/get_next_page. no functional change. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi --- mm/zsmalloc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index e71da84ad73a..b7fab2e28d87 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1295,12 +1295,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_zpdesc, offset; unsigned long obj; struct link_free *link; struct size_class *class; - struct page *m_page; + struct zpdesc *m_zpdesc; unsigned long m_offset; void *vaddr; @@ -1308,14 +1308,14 @@ static unsigned long obj_malloc(struct zs_pool *pool, obj = get_freeobj(zspage); offset = obj * class->size; - nr_page = offset >> PAGE_SHIFT; + nr_zpdesc = offset >> PAGE_SHIFT; m_offset = offset_in_page(offset); - m_page = get_first_page(zspage); + m_zpdesc = get_first_zpdesc(zspage); - for (i = 0; i < nr_page; i++) - m_page = get_next_page(m_page); + for (i = 0; i < nr_zpdesc; i++) + m_zpdesc = get_next_zpdesc(m_zpdesc); - vaddr = kmap_local_page(m_page); + vaddr = kmap_local_zpdesc(m_zpdesc); link = (struct link_free *)vaddr + m_offset / sizeof(*link); set_freeobj(zspage, link->next >> OBJ_TAG_BITS); if (likely(!ZsHugePage(zspage))) @@ -1327,7 +1327,7 @@ static unsigned long obj_malloc(struct zs_pool *pool, kunmap_local(vaddr); mod_zspage_inuse(zspage, 1); - obj = location_to_obj(m_page, obj); + obj = location_to_obj(zpdesc_page(m_zpdesc), obj); record_obj(handle, obj); return obj;