From patchwork Tue Aug 6 02:22:52 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: 13754322 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 429A1C3DA4A for ; Tue, 6 Aug 2024 02:18:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5F246B009D; Mon, 5 Aug 2024 22:18:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC6A06B00A0; Mon, 5 Aug 2024 22:18:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C8306B009D; Mon, 5 Aug 2024 22:18:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 714256B009E for ; Mon, 5 Aug 2024 22:18:16 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1F3EF160846 for ; Tue, 6 Aug 2024 02:18:16 +0000 (UTC) X-FDA: 82420210992.29.554B3CA Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf08.hostedemail.com (Postfix) with ESMTP id 84F5916001D for ; Tue, 6 Aug 2024 02:18:14 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SxdVNQz1; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf08.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722910648; a=rsa-sha256; cv=none; b=w03ZFEIM5r+vCNQcCMoTg9/HjnIxtFt+PiTcmNQqaaXCmq8MliJpygPp7E7mqW6Lf2GyH3 uAhl/n1xpjwcHLi9f4paIjmPLuPpVrcc/+EVqRnkHkC8iwTmsqheX7edbCL/+1pd7MdSch ffKZD9NvTkHhwN38QEqZYXyi1IccbBI= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SxdVNQz1; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf08.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722910648; 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=Yh2M3ze6FPP2pb5gtVIfrEf+1wX6q2uwXp/9ylWsfqo=; b=4fC+35zO2/qH6YJhBZIJbq/hWHIHxW3BwWL8M87JWY5GMPjUCInGamzNrt9GDrR1ztNauO p/HJRJtso4/ftW9My+VP+N5RuWHJKF73x2a+QnuOgJ4YOp6A884TCzVER5JNM3YO1GuTt9 /SrBIDslmC/pFRLkmu+2L8YNQrTXNYk= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9F19360ED3; Tue, 6 Aug 2024 02:18:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 735E6C4AF0F; Tue, 6 Aug 2024 02:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722910693; bh=j9RlWiCV98maWH46GH8LQqP9KXOBrIEnE2eMblguIA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SxdVNQz1yw2axgmM9F16czobZ/4nc0Pb+j/p+kCd1AYPxtcjl3v5C8Ac1KS+WxEJA qHbVrLZrGxWROP255woP/8UgVivsjW7fQKSmK/u3U1YhM2Y5yfKSBcPBnm9hSvwETb tHwuQb3AVPme+ZKcFSzgpl9kj5oiBQM4daNIhzVFI3bO980a3e7XE7995BirXv6581 ZNtaCZgVAX8hzxySY1qD5hfTenjzEHUfm9R+fwANUH/T/lBx0ZWNyrtlZH/O8s3ftT moOpR1aUdc1DFPo49MVi4sKcDA2ExbcNzbWbRSz81ROx6l14RmY1ZjK+/txBfF/I2J DfRyE8ct66jZQ== 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 v5 05/21] mm/zsmalloc: convert obj_malloc() to use zpdesc Date: Tue, 6 Aug 2024 10:22:52 +0800 Message-ID: <20240806022311.3924442-6-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240806022311.3924442-1-alexs@kernel.org> References: <20240806022143.3924396-1-alexs@kernel.org> <20240806022311.3924442-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 84F5916001D X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 83eyit7a558n855mp6d1pgrd6j1jewo6 X-HE-Tag: 1722910694-394186 X-HE-Meta: U2FsdGVkX1+pQmD3+pL40VrGdOW8h2yzXwMjSlvkfpHGUIMf5dbN1kooer7s9xKs34ffYPzmEZZiKvaCmJ4sAMM4X6W7RWeuzpaV3C+jdtnj+/hOb2/xn3zPLL05gLCBIZMOvcLg9p/0+wSUiMMiAf4xx7Z1LKDVUiYQuZv5bvVg4dNxV3OCI+lDp/iIxK7BjMhxmfEd5F8dF+iWeWbvewlhY3hOMOjHuEZ4lqey0soX8eO1TX87jES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W58cgaUgaqrQhin9CdymuYMSZdmdAD3gBTf7e 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 384a5ba49788..7421d7678880 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1322,12 +1322,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; @@ -1335,14 +1335,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))) @@ -1355,7 +1355,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;