From patchwork Fri Jun 21 05:46:53 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: 13706868 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 41105C27C4F for ; Fri, 21 Jun 2024 05:43:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 486D58D0136; Fri, 21 Jun 2024 01:42:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 39A1C8D012C; Fri, 21 Jun 2024 01:42:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 152FC8D0136; Fri, 21 Jun 2024 01:42:50 -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 D8EC68D012C for ; Fri, 21 Jun 2024 01:42:49 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 96B9D80913 for ; Fri, 21 Jun 2024 05:42:49 +0000 (UTC) X-FDA: 82253801658.05.1C45EE8 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf03.hostedemail.com (Postfix) with ESMTP id 88F1B2000A for ; Fri, 21 Jun 2024 05:42:47 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Zt2liuts; spf=pass (imf03.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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=1718948557; 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=6Megb/PlkgrwupGgpLFTJ8z6gVlLhivc7VDBvSmE93Q=; b=QGhuPUqzSKBSuImav/DAl6HkcBnTSoHvs9Sg6iQeA59ddSCX75UxvE/kpqcDKfH985Q3ZC aCe7uypZmC1jYy+mAwGZ3dwx9xVZaEB87KoEx/eHbWf817AtpJEzqPYCyCLZLXzctiZvaw 1qlvuo6SH+e6LvglwcmmYEC78rxfwps= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718948557; a=rsa-sha256; cv=none; b=Vcm/uSzzqWjL5VByq43jTh/+1DMqgQr7K3dTlB0Ch5y2uaKvE0F1Ka5wvySMIoHbz2gJjU Ex9IY2e77nDXoBiAix41Qx1hNtFCLROTjquxflfoS29/puR7Nh0Qx+2Gnniz5F2H1QV5rE aTrRLe1QsM9a3iljKS1PDjXCz1NKsww= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Zt2liuts; spf=pass (imf03.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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 sin.source.kernel.org (Postfix) with ESMTP id E7310CE18BE; Fri, 21 Jun 2024 05:42:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2B65C2BBFC; Fri, 21 Jun 2024 05:42:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718948564; bh=bi1YiTpFhUFGRvPbUZHBdhkxL3sPin4zELQjsCTT+98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zt2liutsK7oexaFQKqUKy8TRoTda3rT7B1LKbaH/xbtnFL/JUig3qUzjaQk64nmTg PE2cpP3SiIOO9DqQehRhtVEbJrvnAKHGFA7kLjug6WlCc81GkT0O/+xWu+LngXcIkN Zhf/+phnJpHf8VFV55ycxsk6RSqieF+MvbbIkKoRdn7zGLAzUlFNmTtBnVOP7DPQha obEjXax3WVszHrEXSNat4nsfockOXEriYwLhkmu/04gFt554Q/iEarrqhvqDcQBPK5 v/YIgnYIEZT3L0xDJxF7bGLOLgDUN5ufC6Yavx+16hzKVpXPPPtG0dMjttpfCbAxc8 wIqnnJDrjcRsg== 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 Cc: Alex Shi Subject: [PATCH 13/15] mm/z3fold: use zpdesc in z3fold_map/z3fold_unmap Date: Fri, 21 Jun 2024 13:46:53 +0800 Message-ID: <20240621054658.1220796-14-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240621054658.1220796-1-alexs@kernel.org> References: <20240621054658.1220796-1-alexs@kernel.org> MIME-Version: 1.0 X-Stat-Signature: 64oib8se48bxomtkdsgfc5om4dnhx3du X-Rspamd-Queue-Id: 88F1B2000A X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1718948567-186135 X-HE-Meta: U2FsdGVkX1/1Z2+UKyMfzDiCzqvOP3qTF8ryavtFJRCnedddJeyWC1dxddHfXhbgJ9UrsVS7QQ+JILaLFjCp4/u/9xuTgNf5OFEoLY9/neljA7NP6mngM9ZbM5j6bkEBv4scOp3IO/DxAzun+Qr3CWMVXfhcofBr11bp4iW0KTz+5hWVpbO1soC8INoBiirueExhtryk4Ne9Fk7fMCa/J0Csxcd4ITXw9TdNXFzBXVqEzArnzkx3HUN/LqWqzmvOYFfYjZvoCMvvjbZXRgDX7bTuouZNLrwz7shApbB9ZLd4imK9n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.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Alex Shi Convert page to zpdesc in z3fold_map/z3fold_unmap pair, the main purpose is doing page->private to zpdesc->zppage_flag conversion. Signed-off-by: Alex Shi --- mm/z3fold.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/z3fold.c b/mm/z3fold.c index 6283f90d1c22..7d95c0293664 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -1175,15 +1175,15 @@ static void z3fold_free(struct z3fold_pool *pool, unsigned long handle) static void *z3fold_map(struct z3fold_pool *pool, unsigned long handle) { struct z3fold_header *zhdr; - struct page *page; + struct zpdesc *zpdesc; void *addr; enum buddy buddy; zhdr = get_z3fold_header(handle); addr = zhdr; - page = virt_to_page(zhdr); + zpdesc = page_zpdesc(virt_to_page(zhdr)); - if (test_bit(PAGE_HEADLESS, &page->private)) + if (test_bit(PAGE_HEADLESS, &zpdesc->zppage_flag)) goto out; buddy = handle_to_buddy(handle); @@ -1193,7 +1193,7 @@ static void *z3fold_map(struct z3fold_pool *pool, unsigned long handle) break; case MIDDLE: addr += zhdr->start_middle << CHUNK_SHIFT; - set_bit(MIDDLE_CHUNK_MAPPED, &page->private); + set_bit(MIDDLE_CHUNK_MAPPED, &zpdesc->zppage_flag); break; case LAST: addr += PAGE_SIZE - (handle_to_chunks(handle) << CHUNK_SHIFT); @@ -1220,18 +1220,18 @@ static void *z3fold_map(struct z3fold_pool *pool, unsigned long handle) static void z3fold_unmap(struct z3fold_pool *pool, unsigned long handle) { struct z3fold_header *zhdr; - struct page *page; + struct zpdesc *zpdesc; enum buddy buddy; zhdr = get_z3fold_header(handle); - page = virt_to_page(zhdr); + zpdesc = page_zpdesc(virt_to_page(zhdr)); - if (test_bit(PAGE_HEADLESS, &page->private)) + if (test_bit(PAGE_HEADLESS, &zpdesc->zppage_flag)) return; buddy = handle_to_buddy(handle); if (buddy == MIDDLE) - clear_bit(MIDDLE_CHUNK_MAPPED, &page->private); + clear_bit(MIDDLE_CHUNK_MAPPED, &zpdesc->zppage_flag); zhdr->mapped_count--; put_z3fold_header(zhdr); }