From patchwork Wed Jul 3 04:05:58 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: 13721078 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 26189C2BD09 for ; Wed, 3 Jul 2024 04:01:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 98E1B6B009B; Wed, 3 Jul 2024 00:01:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 917A96B009C; Wed, 3 Jul 2024 00:01:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 744606B009D; Wed, 3 Jul 2024 00:01:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 4B7FC6B009B for ; Wed, 3 Jul 2024 00:01:42 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0B76714073C for ; Wed, 3 Jul 2024 04:01:42 +0000 (UTC) X-FDA: 82297092444.26.266C0E4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf06.hostedemail.com (Postfix) with ESMTP id 702E2180015 for ; Wed, 3 Jul 2024 04:01:40 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ssU8oOZS; spf=pass (imf06.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=1719979277; 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=7aSS3PfeGPzIHYEgpKcCy3AJpke6a4GKIbhcdDELY+E=; b=JA3NzRegR9upk/w/Ovslve3LwgqOkqdXnxqsojo4HMDi1RI2yyWXcOhkS20z/dwmRPDPiN XCopddG/12IBTaHBDfm171bct5L1zwV/jOftxKANF1YSI10ZBP7r43MzkrW/xGV5gKhGuV 73Z7WWIyJNthM3iRmRuazC+uvihf1Bs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719979277; a=rsa-sha256; cv=none; b=JyXl6TW1wlRZyfs4ah3qnkNT5q443xUR9tnIEe0yB/eePZTyx6DWdC7LRVtS2v/gbFiH6y 0oqpI4l3rdciDsHthlcfnVA7xKpPmxRwXrEaZvstpaTyJNmGaj/VyrdE9burHxWzAsoNgs A30wOCg+NdBJfqhmC7XhLwzW+70YLBE= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ssU8oOZS; spf=pass (imf06.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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id AF7D6620EE; Wed, 3 Jul 2024 04:01:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED24BC32781; Wed, 3 Jul 2024 04:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719979299; bh=hCA+Wp2koQFPErK04B2puEI5lWDR1Rh4V60AMISo3bA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ssU8oOZS8VnZ5kjtvdEP4lDcKyV/8A6M1yM0c3F1KIS8eUI6cNiQvdY87Bb6YlG1V 9b2Qoy4jCAjauQk9G45OXT/p5dW+Jpq9PeP5AI1GVkm+G5B19918JQ/pLqfAPCXsWg c93b4mZRWvKhOEAtTHlXnN8MLEBdsiyswP0TRu5NP202rpZDdQ7/eOVWygU8xreES0 uL4HDJpE4IYOajppi6Nr4yiyTp5ZzDwOjGh6ADzC54ITody68TXzrudEUTH1gWDv3i UwlI4ku7/0UD8QVHuSqhSnWNpJFCsL4RazQOmUsYJCjQWblxy1h9oW+ERZ86wiRePZ AzhbrwkhjIkLg== 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 08/20] mm/zsmalloc: convert init_zspage() to use zpdesc Date: Wed, 3 Jul 2024 12:05:58 +0800 Message-ID: <20240703040613.681396-9-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 702E2180015 X-Stat-Signature: i95bm31c9wmcehywpnyypu3bzbn38fyr X-HE-Tag: 1719979300-861184 X-HE-Meta: U2FsdGVkX1/xQNE/QEJJLc+cj7xWrF2EZW2e5EliA3OW3qspe6znaGa7vTMc1IEmQHThhhBYou0+M9B4N41skmYPGQ6FNS9xnXgVVYDd3/pp15U1+lYIWVCyVNhuklqRZ6Oke134JeUXpoACN/Isy4BJxmqYVtV67PCFVkDgRMYcRJXm/xFc6IX7PnED2zHBJYTMFrOU+WALsMY2TOEMZ1nkti6OQIXANutmbKOKG/Cmnd20XoHOY8OIsYQhbwpW4SEr1DAmVMZtjDpxcdQAi/bPqqEr2umiOm3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LxWkFDb1TIMXoG 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> Replace get_first/next_page func series and kmap_atomic to new helper, 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 29b9fa5baa46..d3558f3f8bc3 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -948,16 +948,16 @@ static void init_zspage(struct size_class *class, struct zspage *zspage) { unsigned int freeobj = 1; unsigned long off = 0; - struct page *page = get_first_page(zspage); + struct zpdesc *zpdesc = get_first_zpdesc(zspage); - while (page) { - struct page *next_page; + while (zpdesc) { + struct zpdesc *next_zpdesc; struct link_free *link; void *vaddr; - set_first_obj_offset(page, off); + set_first_obj_offset(zpdesc_page(zpdesc), off); - vaddr = kmap_atomic(page); + vaddr = zpdesc_kmap_atomic(zpdesc); link = (struct link_free *)vaddr + off / sizeof(*link); while ((off += class->size) < PAGE_SIZE) { @@ -970,8 +970,8 @@ static void init_zspage(struct size_class *class, struct zspage *zspage) * page, which must point to the first object on the next * page (if present) */ - next_page = get_next_page(page); - if (next_page) { + next_zpdesc = get_next_zpdesc(zpdesc); + if (next_zpdesc) { link->next = freeobj++ << OBJ_TAG_BITS; } else { /* @@ -981,7 +981,7 @@ static void init_zspage(struct size_class *class, struct zspage *zspage) link->next = -1UL << OBJ_TAG_BITS; } kunmap_atomic(vaddr); - page = next_page; + zpdesc = next_zpdesc; off %= PAGE_SIZE; }