From patchwork Mon Sep 2 07:21:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexs@kernel.org X-Patchwork-Id: 13786829 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 EB0E9CD13CF for ; Mon, 2 Sep 2024 07:16:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 593F48D0088; Mon, 2 Sep 2024 03:16:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5441D8D002D; Mon, 2 Sep 2024 03:16:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BDAF8D0088; Mon, 2 Sep 2024 03:16:53 -0400 (EDT) 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 19D7E8D002D for ; Mon, 2 Sep 2024 03:16:53 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id CBE5B1619A1 for ; Mon, 2 Sep 2024 07:16:52 +0000 (UTC) X-FDA: 82518941064.21.041B1EE Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf05.hostedemail.com (Postfix) with ESMTP id 3BD27100008 for ; Mon, 2 Sep 2024 07:16:51 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=a24F2VQn; spf=pass (imf05.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725261388; 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=XUKJ1MZc1dZkwnh27HwLVGPFWxYRzt9OnfExQkxqP5g=; b=bhxnMXLgydbt50I7wH21/BkFc4qfobBY0FFnUl4BeVABAeDn4W7fReQvy1WbDSG9LTEYI0 6h/Px0GbcmImckjRb7dF+dN9EbyjVUfODiURN47klUZIBbVAIm+pmIBoSSycSEdB0LKatK /ID0ZMMbpyOxfvbijbos2ywmutwGlQ0= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=a24F2VQn; spf=pass (imf05.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725261388; a=rsa-sha256; cv=none; b=05F49hZ4gG5iLYJjaslVY+CUi71xja7LtRXtoJewffeVeMfh5ScXszCv6TtKm/Wbpy3vzZ lxz/+0lxdIJSqe4qmRYORjWpwcEJq6ng6ccFP7XILQZK02W9F3JEQpg2nR/An2l3bz7Co+ roazorhu0xpqTaLCI5J7Higuyq4vhsA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 118295C2700; Mon, 2 Sep 2024 07:16:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61482C4CEC2; Mon, 2 Sep 2024 07:16:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725261410; bh=8cxk8W9Xo69SGYBFRex8FDtZ09OrBx21iVwdBQgpsTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a24F2VQnLxBeAfFgzkncMF3h1rCsz0+HZE0mPCQdzHFzcAAnrpDMYveicOyyg990A HmRfhw0p7bfJqGm+RryWkBgUWvMhBgTW/uBJbjvf7YLCMIMB0Vhm/l8hsaxn/+mhnw 7WmVG5f14hJSFBysA0DWgujyfNTa86E7yzPq54eu5mJsGTnETUbsPO3OMT5UMdw1Gg cz7Ui+tx7hmuxYk8vVOCa9FxXonF+j/ayOHUXTuIvnRQlVH2Xg9xmlOKZML4wtJLfF zwn28zh8Yv7cNLIzHsX8TjaUmmFlNH8WAh1EUFEf6gINm6luljXGdCM4Tb2JV9Vs6P eYoSK2APZFQcg== From: alexs@kernel.org To: Vitaly Wool , Miaohe Lin , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, minchan@kernel.org, willy@infradead.org, senozhatsky@chromium.org, david@redhat.com, 42.hyeyoo@gmail.com, Yosry Ahmed , nphamcs@gmail.com Cc: Alex Shi Subject: [PATCH v7 05/21] mm/zsmalloc: convert obj_malloc() to use zpdesc Date: Mon, 2 Sep 2024 15:21:16 +0800 Message-ID: <20240902072136.578720-6-alexs@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240902072136.578720-1-alexs@kernel.org> References: <20240902072136.578720-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 6ess51pdytp6t8umotmtak3mz4psra5y X-Rspamd-Queue-Id: 3BD27100008 X-Rspamd-Server: rspam11 X-HE-Tag: 1725261411-325754 X-HE-Meta: U2FsdGVkX194X6AOGhW4T+G9d7LdZzC8EePOJWD6aHGOJoj1KgCFlfdpu3AeeGs5ep6Uk/bcWvwxS5HENOHhYSeny9xEQBP9g3KUWCUjLVLxE6Q+zEWiLtj/Nht62IZo109Ht558LIc1rDKlrz1F6keVW8OXAUB1hwoNd9qFSgi3hW+ag8KKKwoNWV8cZpEQ+h9x8s92BuvkVN3aI6gfnCuDZMLQg4zdroTuFJnb6DxEcxx4z0DHvxZODd/lj4SK98YsJhMz5xldphD7fBSI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vF1xLcWFynJWs/Q== 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 a7e73c0de039..664fff88a7f0 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1315,12 +1315,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; @@ -1328,14 +1328,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_atomic(m_page); + vaddr = zpdesc_kmap_atomic(m_zpdesc); link = (struct link_free *)vaddr + m_offset / sizeof(*link); set_freeobj(zspage, link->next >> OBJ_TAG_BITS); if (likely(!ZsHugePage(zspage))) @@ -1348,7 +1348,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(zpdesc_page(m_zpdesc), obj); record_obj(handle, obj); return obj;