From patchwork Tue Jun 13 20:18:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13279176 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 3100CEB64D8 for ; Tue, 13 Jun 2023 20:18:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1531F6B0081; Tue, 13 Jun 2023 16:18:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B15D6B0082; Tue, 13 Jun 2023 16:18:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E95A38E0002; Tue, 13 Jun 2023 16:18:40 -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 D85446B0081 for ; Tue, 13 Jun 2023 16:18:40 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E29C8405D4 for ; Tue, 13 Jun 2023 20:18:39 +0000 (UTC) X-FDA: 80898837558.24.62CFC1A Received: from mail-vk1-f174.google.com (mail-vk1-f174.google.com [209.85.221.174]) by imf06.hostedemail.com (Postfix) with ESMTP id 16438180005 for ; Tue, 13 Jun 2023 20:18:37 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=iU523P62; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.221.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686687518; 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=maD2yOGQJNTXWHwU2THhq8K/NAnRKyLeT1qKuk6bZHU=; b=L/i0Pu7VC3duatJ8ljNpAULS4AWu7JdEmUPMcAPbLoGtlXUuQRnAygAWGkNHBt+TUknqZq 1U+8HKDzxGXE0TJRhvycO02+axx6nu4FOhnKI2qj0v3wD+uGoOEP4zXRS6ze12Job/8bgf c6h5s7r7BSAdYhzPC05Oe3kMALGIrzI= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=iU523P62; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.221.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686687518; a=rsa-sha256; cv=none; b=n9d2il0zDQ6Z2SNss5vW4ZuFQPEUgNvKbX8OvlNUolksjJTzoc7/xKeILdeJhRYxkyuWjg yagwTrp7hrsXO5stjJDXO6QckBCioSVWxnN54WlR/01Z76eLN075bQIn0EOVTxn8PjVITZ +fhFJOzLKerE/ZvQcBO7G65PEcpnCGY= Received: by mail-vk1-f174.google.com with SMTP id 71dfb90a1353d-46e47a76180so427652e0c.0 for ; Tue, 13 Jun 2023 13:18:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686687517; x=1689279517; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=maD2yOGQJNTXWHwU2THhq8K/NAnRKyLeT1qKuk6bZHU=; b=iU523P6258GfS/ZCsDirRt0LUgWdh+x78uL92gXfwqCf1O5MNCQCvcyNjF+WwJJDOm XdIsSAOMVuSAdaNC6l9OBiK3cTVAx06IypwJittnrw8yIbszhTSazBj6J6UOKE6iKUCp QEljYCfk0ahME2umWuYIUIjnr+OdsoHzZUNcWvzBZqwkq0iVvWq2Px2W6Q9u3PCR8e8V 8+zoo565SSZQGmKAAYGk4wp4LL8W8ovaMUR734FCNOH/kgNxO0zVsir1ersME+g44p+5 KI3lm+OsvGF8DVe/+QLxlpfo3DlxNa4wsG1yltBRopQEZ68n4CtssIfBK5l7/zxp7H3V bhog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686687517; x=1689279517; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=maD2yOGQJNTXWHwU2THhq8K/NAnRKyLeT1qKuk6bZHU=; b=bbSjrUmMcswUkTkoc6sUPAi9YqDTRHOEQLZ9+5GnrqC0wEbdO/KbMnuZqXzK4faXBf w2NPMJ0EnIVbyEejZVgCQ6o3wgvMbWPkqIWPL+KVh31QC5QI9GpS+NO1tXVkzLhQGykV DcDO4FAOne+fw49fCZB7JZJrWgN+fhHfA4Oiqyg6UEDQvbAWAUM+eX+EWVEnt1kQR211 bkVxlWujmrdnLNcP1KdtmX86pXLXE2+qqMcq4Rlq+F+H8mNyM6gPFjWVdbDzj6N5XVbH 9KIK5KZM4Z98zQlIezSjo5cgpMw5ck29U8bwFmP7Pt3oXSFXzWrv4SqQaVBBMXKUzQ67 6I9w== X-Gm-Message-State: AC+VfDywdyYUH9AAG/ptwY4EiTlbzK9IXD3Pj+rTOwS0NrgtuyNFGBbo wiXpw14gPRes88sx3EuKqk8= X-Google-Smtp-Source: ACHHUZ4K3t4K9LE59exWoJJuUPcaKTyDnDyRL9hNFxfUDEDlOp7IvgA7PrzCPAPjm/qc0TVbyX0gOw== X-Received: by 2002:a1f:e404:0:b0:45e:59c4:1e0a with SMTP id b4-20020a1fe404000000b0045e59c41e0amr7824199vkh.12.1686687516958; Tue, 13 Jun 2023 13:18:36 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::e]) by smtp.googlemail.com with ESMTPSA id b72-20020a0dd94b000000b0056cea0480c6sm2509985ywe.2.2023.06.13.13.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 13:18:36 -0700 (PDT) From: "Vishal Moola (Oracle)" To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH 5/5] mm: Remove is_longterm_pinnable_page() and Reimplement folio_is_longterm_pinnable() Date: Tue, 13 Jun 2023 13:18:27 -0700 Message-Id: <20230613201827.9441-6-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230613201827.9441-1-vishal.moola@gmail.com> References: <20230613201827.9441-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 16438180005 X-Rspam-User: X-Stat-Signature: pzp8pagjf4p8dcottx6b4gdxrrhdrsss X-Rspamd-Server: rspam01 X-HE-Tag: 1686687517-669607 X-HE-Meta: U2FsdGVkX1/pnkDLEfO7tz5K5Z8PD0GhkaCK20v5n26jy0DMS/7mQNEa+FA8V5CfzOS9Sk/nrHuCZlct0mk4XvlALv/NUAcCIMnNTvK2kGSvWXjdk54VXOrJZU+Ojg1oESXTVBTq87fnh3ThdpWBPkFCarq72FalCDs82OS6EJW4Hwj1aUeDQ3ChmNBOZis5uwP9FWS4C3GIcr68GsGSrDezhMbeRXDI+wzo6n+RJAzBEQNRT1G/hGujoU5HoKD5y/zQvmslBuG+9U5rr17oOrC6Dqvlcpo68fQAEbU1QY169z/wsH0lFgTJ63v4DpSpTzXSVpVduPRiDK/AFAQDTp6DLbirQDi9ohmZ3n8McWnaMWheNPEXbF9IiuWqLpHMpL14Jv6hPwIlqdlzc7DkOBxGEzWz0Gn2DL7Ol78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xOfCXKFiR7fQXACyzL+1Gzq+s2clCymv09aHif76scS24tE5y8Xqmc8knV/+zDIiZY4CHOEX9TDIgb+0hPyC8= 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: folio_is_longterm_pinnable() already exists as a wrapper function. Now that the whole implementation of is_longterm_pinnable_page() can be implemented using folios, folio_is_longterm_pinnable() can be made its own standalone function - and we can remove is_longterm_pinnable_page(). Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 27ce77080c79..e2d35e272e07 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1910,39 +1910,35 @@ static inline bool page_needs_cow_for_dma(struct vm_area_struct *vma, return page_maybe_dma_pinned(page); } -/* MIGRATE_CMA and ZONE_MOVABLE do not allow pin pages */ +/* MIGRATE_CMA and ZONE_MOVABLE do not allow pin folios */ #ifdef CONFIG_MIGRATION -static inline bool is_longterm_pinnable_page(struct page *page) +static inline bool folio_is_longterm_pinnable(struct folio *folio) { #ifdef CONFIG_CMA - int mt = get_pageblock_migratetype(page); + int mt = folio_migratetype(folio); if (mt == MIGRATE_CMA || mt == MIGRATE_ISOLATE) return false; #endif /* The zero page may always be pinned */ - if (is_zero_pfn(page_to_pfn(page))) + if (is_zero_pfn(folio_pfn(folio))) return true; /* Coherent device memory must always allow eviction. */ - if (is_device_coherent_page(page)) + if (folio_is_device_coherent(folio)) return false; - /* Otherwise, non-movable zone pages can be pinned. */ - return !is_zone_movable_page(page); + /* Otherwise, non-movable zone folios can be pinned. */ + return !folio_is_zone_movable(folio); + } #else -static inline bool is_longterm_pinnable_page(struct page *page) +static inline bool folio_is_longterm_pinnable(struct folio *folio) { return true; } #endif -static inline bool folio_is_longterm_pinnable(struct folio *folio) -{ - return is_longterm_pinnable_page(&folio->page); -} - static inline void set_page_zone(struct page *page, enum zone_type zone) { page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);