From patchwork Fri Jun 21 05:46:49 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: 13706864 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 8C566C27C4F for ; Fri, 21 Jun 2024 05:42:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 706E56B0128; Fri, 21 Jun 2024 01:42:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E9AD6B0125; Fri, 21 Jun 2024 01:42:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E7EBA8D0133; Fri, 21 Jun 2024 01:42:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 902818D012C for ; Fri, 21 Jun 2024 01:42:37 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0D245140893 for ; Fri, 21 Jun 2024 05:42:37 +0000 (UTC) X-FDA: 82253801154.23.40D439C Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf12.hostedemail.com (Postfix) with ESMTP id BEC5740006 for ; Fri, 21 Jun 2024 05:42:34 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ghaTGi+U; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718948547; a=rsa-sha256; cv=none; b=tYJoBfFxiLIBA1ARH2fvewcgMA/srefkr6QipJ1X5704t1XB8Xm8chlMEIMBwJgGNO6Tpf eRrUMxndP6PJZ9OLGZS0mIupY8SGXFDwHZNSWTpTHZxIg1DTFy/pr2dFWmfZe5sW9rNOv6 300rRqwi0FJX/dz3uSEKw5MW4g4Njxk= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ghaTGi+U; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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=1718948547; 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=J+J2PItsE1ri1g7rWwnqytorc6qNmjtZEhn8PvI1sEk=; b=X5nsR21X75slg0KFigesHH+QcqdlbHxxDVGeiViNOYEBywmneU1uwYHAhP2Cu+iqw5diFH ixMvoeV1Th5nVUb3/Rt9hC5NWCZRQfy9m7YmQ7YvPmPecewdt7QPUmXm3wKRfIwNeqRYHD r/1sQgG6mFUEnEHRB9ZcSHPz1qA32vE= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 46CCBCE2B5A; Fri, 21 Jun 2024 05:42:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DA2EC4AF0A; Fri, 21 Jun 2024 05:42:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718948551; bh=y6KoeLhtvm8xPFObZNaibmIhv/1vXuAoQWjifV7MAf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ghaTGi+UM7rTyHmBOXsg4g/Q87Fxag1B+8BTmn51DnnCTFVZEYWtdlc1Bq6m3a9OI rQmyMjlhsXeMSLdsf0OBDkZ1iiUBcbohmeGSHet9Zbf7odS2O+5sYO1rxn7TGCFPwB 7nWzR442GxYjaomeWTuFa/aYTj8j5EeBGaln1+26V2j470pWPmGx2LJEwONvA9SvRT e0BhQPgYEahIKbmo0CW1nY82aDZg1EpHbZQQ1YQgHfehQwIA20edDZL8ekXeXcPzUa /paqNPM9jXw3gMc1gIQbA8PPVvb3zcgJ6xvaBNXvzos35sn6ju19wMc/BEc7n5v5x5 nRmPjpjlYopSQ== 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 09/15] mm/z3fold: use zpdesc in z3fold_compact_page and do_compact_page Date: Fri, 21 Jun 2024 13:46:49 +0800 Message-ID: <20240621054658.1220796-10-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-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: BEC5740006 X-Stat-Signature: cth1f3iygfd151kgiufewn4ed99xau85 X-Rspam-User: X-HE-Tag: 1718948554-283547 X-HE-Meta: U2FsdGVkX1+YYvaG9cfdPBqlYvRmnzE03nSpzXED7+RRKtkveI8Zk2z49k7PFeP8p9oDu2usGCeQlZKynUpsBDBMHLF9rKgqk0cyGZjVqcVTBAgJSzhb/NlDfM5ex5glZ7FzCFA3pq652WjiG/hn4KdfuR2CERoAxGexONj9YgREEjxSxfUd47TXg9Gb6aR625Mew4pEsIYRiO2vZqGwRzz3f8CHOIcSixTvyC/TLT4fYvCL+y+DKklbORln8sicy4MBog+gZi73ZBQCbUQGrY5u1VcErWNZkdl7nNKt/bkGsUiF5pOL/82jXu/pERLz+ReBWydRGLKlVMqogUMgkwSfPTdS813fLINYvwJqDxNIFwVffczlZ2xfBFblWMmZvIy3p1AqtHpu+57wJeAt17BftyhXIwOsf6/DyIkUwjFV1nMc0Ca+v8ZNeuRCIa/QRqEK9texyUOVNyefqi0n0NoV7HbTGHatYlf/wqeLnKqGLjXfbp22QFLTqVFSzgOTleswuttA/f4fGZmxsQLpf4aDMsVV/fs0sSzLof2Fw5ZltmUp9e4kHvEjbbBD0zGHQVrATX2ULRCGUGveJHfidrpfbhyBXDn4RynHe8FeBv8zvnEtjaNf7UYt2NBGxDFlk4QCOWwC9VNVP7juI0VX9isRrLBH3ywHmePybuyABXpLuzIPYoSLz/rwGrRFS1iTOC7ivLpKpEs2fZ0rvlsyd38ATHdNpM7B+Z9sbVIpPB7GJIv3ojCuZRtTNZpvEW5vkY+tQSeagga/ol55fA1d9nA4tR3zL7uu9jfi4OByJoKWDzRoWMaRq0pEwlnxPukrKl9dxuIMrHkImVq5lz04aT5sn3WbcFTPY7PRZI+IpEoB1PxL3T22bedS0aMwL3Ndxm9nNkPGp5qPJjEy73+f7ozrbzCQelqabZeDkFXXvbxSnXZuGMMTGNA200NhrLsMO113Q42v1HnVfRqymMj cULmFvVg 9k1MyJ4a2XwTDQReHpkIzWaNDUcLNlPgaZOpvpfXdf21oHO3hjCzJbW/3QKE4caE4LCVO7FjmLFbJZlEiItop7k3pPjmvlRnsnTdCbOSiO5CWAJvWCJxodpItlLXxGC1iRP2B26obobFy6VaOnxymU7lmDYbutAWJg4sD1bopbecdE2jZ25yOLsOZOdxNdQjBMx6R4VslyXamWSD34Y5epzN5vU7XrpdygiLwd077nm1YDFnmp1hpwj87V+LzxaJtb0wg5AqjaSlUf+jSBU98Ni3hKgW+pt+hJQwO68WSwY8v3FFRaAZ3Er/P1jqeAdIq4jU3l3Hei7N2VliHXH1tjT8viCKATk2WtOxb 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: Alex Shi The main purpose is converting page->private to zpdesc->zppage_flag too. Signed-off-by: Alex Shi --- mm/z3fold.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/mm/z3fold.c b/mm/z3fold.c index 97580e2224c2..3d36448885c9 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -691,12 +691,12 @@ static struct z3fold_header *compact_single_buddy(struct z3fold_header *zhdr) /* Has to be called with lock held */ static int z3fold_compact_page(struct z3fold_header *zhdr) { - struct page *page = virt_to_page(zhdr); + struct zpdesc *zpdesc = page_zpdesc(virt_to_page(zhdr)); - if (test_bit(MIDDLE_CHUNK_MAPPED, &page->private)) + if (test_bit(MIDDLE_CHUNK_MAPPED, &zpdesc->zppage_flag)) return 0; /* can't move middle chunk, it's used */ - if (unlikely(PageIsolated(page))) + if (unlikely(PageIsolated(zpdesc_page(zpdesc)))) return 0; if (zhdr->middle_chunks == 0) @@ -739,14 +739,13 @@ static int z3fold_compact_page(struct z3fold_header *zhdr) static void do_compact_page(struct z3fold_header *zhdr, bool locked) { struct z3fold_pool *pool = zhdr_to_pool(zhdr); - struct page *page; + struct zpdesc *zpdesc = page_zpdesc(virt_to_page(zhdr)); - page = virt_to_page(zhdr); if (locked) WARN_ON(z3fold_page_trylock(zhdr)); else z3fold_page_lock(zhdr); - if (WARN_ON(!test_and_clear_bit(NEEDS_COMPACTING, &page->private))) { + if (WARN_ON(!test_and_clear_bit(NEEDS_COMPACTING, &zpdesc->zppage_flag))) { z3fold_page_unlock(zhdr); return; } @@ -757,8 +756,8 @@ static void do_compact_page(struct z3fold_header *zhdr, bool locked) if (put_z3fold_locked(zhdr)) return; - if (test_bit(PAGE_STALE, &page->private) || - test_and_set_bit(PAGE_CLAIMED, &page->private)) { + if (test_bit(PAGE_STALE, &zpdesc->zppage_flag) || + test_and_set_bit(PAGE_CLAIMED, &zpdesc->zppage_flag)) { z3fold_page_unlock(zhdr); return; } @@ -766,7 +765,7 @@ static void do_compact_page(struct z3fold_header *zhdr, bool locked) if (!zhdr->foreign_handles && buddy_single(zhdr) && zhdr->mapped_count == 0 && compact_single_buddy(zhdr)) { if (!put_z3fold_locked(zhdr)) { - clear_bit(PAGE_CLAIMED, &page->private); + clear_bit(PAGE_CLAIMED, &zpdesc->zppage_flag); z3fold_page_unlock(zhdr); } return; @@ -774,7 +773,7 @@ static void do_compact_page(struct z3fold_header *zhdr, bool locked) z3fold_compact_page(zhdr); add_to_unbuddied(pool, zhdr); - clear_bit(PAGE_CLAIMED, &page->private); + clear_bit(PAGE_CLAIMED, &zpdesc->zppage_flag); z3fold_page_unlock(zhdr); }