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: 107527 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp802971vqr; Tue, 13 Jun 2023 13:21:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7AcGVR+0A7sFBZdUJxiVdtangVglSvpCTK53UmFmX2JP8Pr/7ktKHjz2qnZoGB6PwtQICg X-Received: by 2002:a17:907:2d0f:b0:965:6075:d0e1 with SMTP id gs15-20020a1709072d0f00b009656075d0e1mr14304400ejc.72.1686687673765; Tue, 13 Jun 2023 13:21:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686687673; cv=none; d=google.com; s=arc-20160816; b=s1929rtZHbsGi4JS6RMG8yXvoKmGTbLwBbUHwTNDwcbNY26Hp2gwC0Ri2OvGgNkcT2 +95vU46i9gj6hQX23AXFsuY+PkG8mbFKdoL/TlLpp+Clo8/o/lJfFu+zVron+70SxbwZ ZUBFyoby8QzKCpEJ33gyuvVKy3SThpBBdCH+JuEJ4qOx9RGXT2BaLhNuHZI+d65AwqhW fBZbtb/3ybwoTROXIRkNHqTGMUrgqPdRK8DMlZJOUzZ4qMLjZIkFePKbCCu5gJwCsodw LptQj7+sqqBoCxGq1BxIoGr/ZWMVLyNZIKSx88qcYE7V0UIqFH0WTCmAYqZjOkD4LIaX crhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=maD2yOGQJNTXWHwU2THhq8K/NAnRKyLeT1qKuk6bZHU=; b=j4OulOmaHnEje9c93SD1LvEgsRSiOdTH3S5izxK788h38k+PQSUXZdTT80RVkOuY4/ 6cocEsdTM5KmJL/r4PIk8ZfwJb+0gC+ue+0Eu/FuDqm6CmmTRwWDlFfw3UppmUJBFa1p ZN8NdMWGRjLweY5joJOLWDICLEjN8VT+lCkObV0GFienfag61qQtgu3XJGyDTSkhMMgW 0S7rI0Yzd4zs/06qzKNyKnoeP1w+6RLuq7ecIOYJOHvnVSk0PMu7FBsXtsYtWi2rtLFc 4OdvbJqtmUWRXkqiguGsPk9TrAuQxvaOKHlHRV+AJvU/4CGDvsegXnCdfo4kX+8DcYh0 s0KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=iU523P62; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020a1709064c4700b00978ac73ab25si7208122ejw.540.2023.06.13.13.20.47; Tue, 13 Jun 2023 13:21:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=iU523P62; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241018AbjFMUTW (ORCPT + 99 others); Tue, 13 Jun 2023 16:19:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241106AbjFMUSz (ORCPT ); Tue, 13 Jun 2023 16:18:55 -0400 Received: from mail-vk1-xa30.google.com (mail-vk1-xa30.google.com [IPv6:2607:f8b0:4864:20::a30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00BE61BEE for ; Tue, 13 Jun 2023 13:18:37 -0700 (PDT) Received: by mail-vk1-xa30.google.com with SMTP id 71dfb90a1353d-462e3a806cbso2080910e0c.3 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=KZwfhgvL1TrPHIAz+jcDU1RT4gUrLoh/NcO+zmWFQvHLBDEcRWbTW1kU78XrbPwZLX iw2Rd53tfRuS1mbmy47Yx8wqZAUpd9QAmu6cOTwCJ1N6wDbz525hvAxur98fx7XFsb+i +/MOCwWmBEyqUQrhOl2CfsWmXm7by+/RP/g5NJSaxA+2TrZ1IUDCsjZ9tvNmfpLL9hP/ LbSCBZfaevTv+/TEdtcaaP0PDfKZIo2Hw9wFkeWiPlxLl3LqAxjrINKjE2ynczAwpYNR X8H15pQWXWzVm8YDUdfkn+tBRGwMotSAazESdHS+K2pUEhyZis1sEPLLF8IV1Wr+IWis niQQ== X-Gm-Message-State: AC+VfDwtzGCk3bPF4IelXkaKpB0Sd/SHyclpq/TXlk2sWugmZtJg4bbV oboMHfxjBETh+c6ePlOVGD0= 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768620214272095952?= X-GMAIL-MSGID: =?utf-8?q?1768620214272095952?= 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);