From patchwork Thu Dec 5 17:49:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13895904 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 5BFEAE77170 for ; Thu, 5 Dec 2024 17:50:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9A4896B0189; Thu, 5 Dec 2024 12:50:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 54E986B0193; Thu, 5 Dec 2024 12:50:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8CBF6B0194; Thu, 5 Dec 2024 12:50:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id F3DE46B0189 for ; Thu, 5 Dec 2024 12:50:09 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 6FEF2C1667 for ; Thu, 5 Dec 2024 17:50:06 +0000 (UTC) X-FDA: 82861643256.08.75C27BC Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf05.hostedemail.com (Postfix) with ESMTP id 07667100003 for ; Thu, 5 Dec 2024 17:49:33 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=joDubJBJ; spf=none (imf05.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733420994; 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=teUYba9V0lgZDe9TAPyaRDbtKArjvl8uhoFbMpANONw=; b=VLlho7j7Kgi+fLf91dcr7AibtumHae+oDC3n8NgOP55MjjW5yALiwCYUFiVOujgQ0wySwf KPMndjPZLgxv4/YDBfiqSybHm4+PsaILJSCkkuebb1poEOBNBGsyi5siVLgByuv9XXi8fL /IThg/LMu8cf/4PsG8Qcp7mLwCE5DaU= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=joDubJBJ; spf=none (imf05.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733420994; a=rsa-sha256; cv=none; b=EAsissv7tzN6uUEpC2uTMq7JDdVpexOgwV3z3chKSYsTduuJkGD7G2+O4WZxISFApmWgv1 oJ5NTKfZPuuraiqlbLZMt5ygFM0mooAdRfvix/s/oIFokAfc9wmNdlCYhN7GPjtCv5fw7N AL7E+K7omzpkZHkfLkcTK2EHIino9aU= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=teUYba9V0lgZDe9TAPyaRDbtKArjvl8uhoFbMpANONw=; b=joDubJBJeIY6hlBT7FcmGBeOk2 dhU+19HVTqKNhTN483sUjxSWNnpO6ZWrUk0eBmLrHCORKQudoMiIrU0fNIIESAZW95DVsuoiL9p+o +p9hSAbHw/p4KQ9KfMTw8THku6YfOUKAVhOwUUFLQT7vhC2f5SgYoCLd2/dfM6mCtjzOnN0FuUIX2 hVAfimph2m05vzIFJmPwauYScOHQkyNwd/PDgxlVneSj3vLxa0jrAVC0gpLKiEqOtFNA2Op08eSPm FHOxrDDrVFgCnEoWuNCzVJzqEVG8F6JwW6sX7xP1LNLhamlOl5Rocomg5eoPa1Pb5E9Ft61b3uoSy sGHrI2VA==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tJFzG-0000000DN7e-3ZUR; Thu, 05 Dec 2024 17:50:02 +0000 From: "Matthew Wilcox (Oracle)" To: Minchan Kim , Sergey Senozhatsky Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, Alex Shi Subject: [PATCH v8 05/21] mm/zsmalloc: convert obj_malloc() to use zpdesc Date: Thu, 5 Dec 2024 17:49:42 +0000 Message-ID: <20241205175000.3187069-6-willy@infradead.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241205175000.3187069-1-willy@infradead.org> References: <20241205175000.3187069-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Stat-Signature: 4fwxd6bm44xw3poyy77kj4sbnj1kcny9 X-Rspamd-Queue-Id: 07667100003 X-Rspam-User: X-HE-Tag: 1733420973-855889 X-HE-Meta: U2FsdGVkX1/SUE0eE70IgF1NJhA8yT02/5BlP5pcY3UexXjTmkLeBCBdlsLnLmjquXm7Vml78GtrF/b4ag29XZHxudBlQTzFl8Y4oW7acrye/rbPhNMhx0uhmOg7BCAnQS8U8H24eV8DFQ8vo1zekh4kn7ElySuyzrNJvvOMID8Xm90CD+jQAUq4T2a4YbW/xhhm4VxqTiCr+Euh2DBkk3i62hyJEEFuBuouPLT7SehnDdPszCT8Eg8xTotxr04HTpXB5uk2Unqd6CKM6T/osSEi9YApKjQ1qjRrP/jBtwr1ljGUoKzBZdZsk9N3eNQFIrKFeZNC76GtjMSnOF5FuTm6bCce5RyR+UB7GpZoo3bhJOZatGS7MYxbHlGwKHyMs/+mXD0eaN+lVd+xBYQpJrxgqu5eQko99yFKDtjekuww4CqkdvOoA0asg+LkLeDbCvblfrwP7rWP9cCQ9Zd3/IQitI/rh+S5UvlhSpL8nACyOMqch2rM8Rcritb0RZreh1FrrAW+L0615UpX+Xs+/MoNrLZV/TO0XRKIl3mCsnZ+WoHma4vkJ6vfGR5ge9rZU9skgA2s8IiMRpTzesSORiWaYsj0Hqt/Kprj0nGfM3abM7B7cHIP7pxkhglH/i2/rM8Sg/Xeerw6vjh+HQu9d1H0gzAYswomgesdYFhUm9mO0Pz+2nuPPFpd+UtJxBJxoQy0xdjoY7j07f/QiPWIepvBYAhVr/3AKMl9hk+fYPxPEG+0grLCFXHfHvUhY1c/E9kUIAnSFMW6LOMUPl7bs2d0Xg0r+oN3z7Et5nourzPuLLb2KhkGqf4mbp3FMB7bUX9aMygBI66ISzYuw6R1fS+Wrd2JSPvrb1kZ0biq98kbVtez4v12HPKpLTYTfa8nQsGyGPTpUV4WX7nNYzfo5RnaIim4kP8+XR1udmwHaiqMH47BFS1yFrDniEE1g/OGbUYR8akSRX3P6lhwLS6 JLgzRVUr ygAtJQ2c63AlSglvFIIMNmwmgqnxoWewlTTvu6Cphf0GcaJR8GmXxo/Sf2FO0SwD4FhZQJ95Ub9uy8jpx4OJVhrXof8ixJkVqSGQcNV5dpI0ra8wqSx7oJxLzMtAkZx8fPz+S+cQq0vsjjB1ihwUZsSqRpGiDUz98QFIaWsE8zea/KXYOFBaLg2Q/ZdPxmL+ULQiyBJd0tNhQU5ZdvuMlCwCAAzbTsjo4QcD7AndmeD57QkgEOyKuvIWLbqi5zNPpl4OorgVMvYaSefcSVGj1EjxH0Lvz8ZkXUVcRQhBSgQHzBybRdJ9u5nOxmY1jgkdVBfpfu40+7SsEGMt1mfWftTpGhw== 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: From: Hyeonggon Yoo <42.hyeyoo@gmail.com> 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 03b77690c616..af8a6cd6b814 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1313,12 +1313,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; @@ -1326,14 +1326,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))) @@ -1346,7 +1346,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;