From patchwork Wed Jul 3 04:05:55 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: 13721075 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 EA550C2BD09 for ; Wed, 3 Jul 2024 04:01:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 212BF6B0093; Wed, 3 Jul 2024 00:01:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 177FB6B0095; Wed, 3 Jul 2024 00:01:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E6B866B0096; Wed, 3 Jul 2024 00:01:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id BD3E66B0093 for ; Wed, 3 Jul 2024 00:01:30 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7599CA06EE for ; Wed, 3 Jul 2024 04:01:30 +0000 (UTC) X-FDA: 82297091940.08.00AFA6C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id D4DD680028 for ; Wed, 3 Jul 2024 04:01:28 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Ygl1r0eG; spf=pass (imf30.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719979270; 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=VMCQhHDdGJOKLu/KVq7ZZe30LH202MU5dyPStXWIX7Y=; b=xpcDja9NnVUrb+WrO4mTEasRSOMPbGK2UNJ/8Yr0GkUJFdk9yRrjxtHTalefzdG1ksqH4d pxj/+QBiqH+Zq9E51UM0jVw1axU1Ae6Vq5Z6rbh3/p5KxzlZZahYM5AVoXi/ENUy+80am7 9oTKgRzzwTyIgdI83L5ygarvEYZadFk= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Ygl1r0eG; spf=pass (imf30.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719979270; a=rsa-sha256; cv=none; b=X8A7af8hwjlrjBihL19fT+Q005vxRjZQRfJTtqXN4lKxYP5G3k8PGjQ3kiS5zEgc5sCc/G kqendtytvldBJ9EdKg2gfyNHLX5vGJyZJt0KSfkMmMiyQNUpY+dO4FZV7T0vGl2i26qDlq 337brRpo/3ryA4oURjyUeCpkZctCZ4A= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id CFE23620A2; Wed, 3 Jul 2024 04:01:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69877C4AF0E; Wed, 3 Jul 2024 04:01:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719979287; bh=OUw0L1+EEkxStexhrY6FwqktPPZ5HwiknqjqfzU6PXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ygl1r0eGWf9A8ASCCyxxwaRcR/wNniNavWp/6Cp1Fb7i1Ie3OgUnLu+kb/x83qU4R Rtf1OTjVxaWrDtnC9EgWP60cL+fwY6UmOlhSy0g4md3TDCs0I58Xpeo2fYMQQIC7oa mWGA7aDYGYwcXPiw7U3+CqO0HQFqXZbuFcR1HrgtLk0mCgqKSqgQeVqgpEC7iJDFyx Q4W+t234bRMiEvLqUICPWSBBwtKPv/pZtcYWjGAGrHvheKJd7nLq5kdFh/6V+jbw9b EBrXUKpPCHP3lHr26GXnoTiIoogZTVS7XgIzHuJjYkhr/Qv66r8sBvtyhi/jVwGPTl 5r1Wts9gy5n2w== 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 v2 05/20] mm/zsmalloc: convert obj_malloc() to use zpdesc Date: Wed, 3 Jul 2024 12:05:55 +0800 Message-ID: <20240703040613.681396-6-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240703040613.681396-1-alexs@kernel.org> References: <20240703040613.681396-1-alexs@kernel.org> MIME-Version: 1.0 X-Stat-Signature: cyiyq83umbfqwr9a19rcjskscc9o9djk X-Rspam-User: X-Rspamd-Queue-Id: D4DD680028 X-Rspamd-Server: rspam02 X-HE-Tag: 1719979288-387117 X-HE-Meta: U2FsdGVkX19DOaoVaNwvRGEW4CiQWa0OANqq83OpFmIQ+1DsQvcvAzpQOVsParJXkljqeCwPdj8jvmvgvy0infRvCZn7UV+1JD2raZlHWeBB1d6Mp1R7wdQeuPjaBJtn2wPnAf0qEAq58yn0WAEgoNBTa48S1raugjJu1pDCoGEbn1rOyZtLlnz+eXqMl+P5PE3oGpWu+Le96sG4qOnLd+9tYviXZ7qVRFVMyCCg98lXa/nk3qrt6p+zyb/pDTus0aHIkN3ks+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YFAXx4h5gdK1VDmUbPOxl5Vr 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 149fe2b332cb..bbc165cb587d 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;