From patchwork Fri Jun 21 05:46:54 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: 13706869 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 73511C27C4F for ; Fri, 21 Jun 2024 05:43:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6A9E28D0137; Fri, 21 Jun 2024 01:42:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 632208D012C; Fri, 21 Jun 2024 01:42:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45E108D0137; Fri, 21 Jun 2024 01:42:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 19F138D012C for ; Fri, 21 Jun 2024 01:42:53 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id BAD6D80918 for ; Fri, 21 Jun 2024 05:42:52 +0000 (UTC) X-FDA: 82253801784.23.A71F875 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf14.hostedemail.com (Postfix) with ESMTP id A5327100006 for ; Fri, 21 Jun 2024 05:42:50 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Smo9cGIV; spf=pass (imf14.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=1718948562; 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=xZ4u4n1bR0L8Bhv9HGhI/tmnwckndauqfE9jsrkziy0=; b=nUiZhoMQChNdHKpbO/qoDPU7iBiwi2a372AKinJ5W1sAAiUQ0X/WdviRc0w3AYLs4utiNM 5wyjDQYhsc9AVAw6onfPIGmqVGRRe2IMeY6xcI6zgoHZHn261z3MdaNlYMu18lO8Ac4j1J Lud27mcC5iGToX6PqCbsgEfw/xV0Wgk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718948562; a=rsa-sha256; cv=none; b=Z5WonsUlS60Z/hfV0+LDyLOJGuaG6t32em7bP+3sDrflgHlCmXqj07obhtjbjUDBEoHsVM R60lmoFNq/tP6LLxoS79pF/QBzIFxu31WEuw8IbqClQkjb4Cc1ezfVdQUBB2wt5mEboXwO gqqf3nBTtaWFvc9UNwcjDrnL9ze82X8= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Smo9cGIV; spf=pass (imf14.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 0E75FCE2B4E; Fri, 21 Jun 2024 05:42:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9C11C4AF07; Fri, 21 Jun 2024 05:42:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718948567; bh=ZVUFLxXaSMstqeF9wiClbo0Fyh0HfCRoDm04x2KLjcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Smo9cGIVWmL2EmyJ8D3bauM2U8VHnP86YPTsc7LWNyv9TNzRXhgzPZGt/BHOQIZzc SZwhipISzcDFOzAYG7tOzqpmjxFuK3oXYwHeoKJ1EY7JJY9P/yvz0lkw9h9CKZ1VG5 RtVZEWyyUY/f6CYtFuUuU4SDpViqbTHhTFZkS4vCwcPTliT7zeA4MGNgCNH43Vxn+W O4Pd09FFoTkrvcCROJvWAREpQd71+NTQ5ZHuv1nv8aWR8g8jlRTS0dfYrxhodoIvo8 F2I6UKDa/XO/cSmo4+hYNCuEhAJQ7lBNcEMPNrORnwi1syjk0hEgoySbpNH64e6nvR uyORwIdsuKSAA== 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 14/15] mm/z3fold: introduce __zpdesc_set_movable Date: Fri, 21 Jun 2024 13:46:54 +0800 Message-ID: <20240621054658.1220796-15-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-Queue-Id: A5327100006 X-Stat-Signature: aaprdia5zty4af83n9pw48ob3q1ap4cj X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1718948570-482494 X-HE-Meta: U2FsdGVkX1+ANZWkfSFhpOz6bbjsEzskBZo3Q7OJvNZbl+jO+mUBpEOhH96lOQWVFsuy+YF68GvK/XZ05DCYciOW6osVAS4CLSgmWAlz7zEBB465XrToolpRzgXmB2mzHQQeOZbMgLqqUhA5iMeMJSpaXUU+2/j9+8db2P/sp7+ElPYpNuCjX2b8iJX7L/d0FX2jdeYhS2D2QFmX5v3g3CxQeBa5nxigfQ1St0qW9CEqHzxSEMkwGqDoqrQkkPUIRpqTntN2Uc5NfoaRDp2sUB7Ntw+3ITO+sm413I2Vhbv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ity: 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 Add a helper __zpdesc_set_movable() for __SetPageMovable(), and use it in callers. Since we actually use the page.mapping for 'struct movable_operations' pointer, we could add it into zpdesc struct now. Originally-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi --- mm/z3fold.c | 6 +++--- mm/zpdesc.h | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/mm/z3fold.c b/mm/z3fold.c index 7d95c0293664..35e48440c517 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -1050,11 +1050,11 @@ static int z3fold_alloc(struct z3fold_pool *pool, size_t size, gfp_t gfp, } if (can_sleep) { zpdesc_lock(zpdesc); - __SetPageMovable(zpdesc_page(zpdesc), &z3fold_mops); + __zpdesc_set_movable(zpdesc, &z3fold_mops); zpdesc_unlock(zpdesc); } else { WARN_ON(!zpdesc_trylock(zpdesc)); - __SetPageMovable(zpdesc_page(zpdesc), &z3fold_mops); + __zpdesc_set_movable(zpdesc, &z3fold_mops); zpdesc_unlock(zpdesc); } z3fold_page_lock(zhdr); @@ -1334,7 +1334,7 @@ static int z3fold_page_migrate(struct page *newpage, struct page *page, encode_handle(new_zhdr, MIDDLE); set_bit(NEEDS_COMPACTING, &newzpdesc->zppage_flag); new_zhdr->cpu = smp_processor_id(); - __SetPageMovable(zpdesc_page(newzpdesc), &z3fold_mops); + __zpdesc_set_movable(newzpdesc, &z3fold_mops); z3fold_page_unlock(new_zhdr); queue_work_on(new_zhdr->cpu, pool->compact_wq, &new_zhdr->work); diff --git a/mm/zpdesc.h b/mm/zpdesc.h index 9ead7a452f2a..44473382f2cc 100644 --- a/mm/zpdesc.h +++ b/mm/zpdesc.h @@ -73,4 +73,10 @@ static inline void zpdesc_unlock(struct zpdesc *zpdesc) folio_unlock(zpdesc_folio(zpdesc)); } +static inline void __zpdesc_set_movable(struct zpdesc *zpdesc, + const struct movable_operations *mops) +{ + __SetPageMovable(zpdesc_page(zpdesc), mops); +} + #endif