Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1739647rwd; Tue, 13 Jun 2023 13:31:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5XvcaIEAIkzbzOVLAzclKPNgWdu48k+YZAS+4wzj77ofOfes3Qd7JVCgECKg7AB3R8Cpe+ X-Received: by 2002:a17:907:1c83:b0:982:501a:62be with SMTP id nb3-20020a1709071c8300b00982501a62bemr1000835ejc.39.1686688270312; Tue, 13 Jun 2023 13:31:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686688270; cv=none; d=google.com; s=arc-20160816; b=pzvYoOTCb01I9MdlkC1+GJ4D5dx4oJFkI480WsET+BhvktNxT9myBDFLNUdl7LsGOk FgLbBb6SZHxCPFFXYWooaznS1jyozrLkR2zcECE6FEd8B6JigrlbmgXzvb7k5cojLmRB yJixC9IRvfZnfUyhI8BsgRmKJ4XoEYzwNCkfSkeQhSuMbUL6HCEEXM+F4sTKoC0i4hpw /axYlYK+Ce7itMwcDeEDWHZbQ1awQBUdw4jJtl7Swx78xQ4nrmRJu0WA0ocGhVsz3Dxq gSSPVq1dN2U8tMf6CV5vORcbFIVhiSUhH6RseeK0Nl9T4HgKt1wVcsQzTG5bnitjn3CH ONpw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv20-20020a170906b1d400b009746334968csi4154383ejb.196.2023.06.13.13.30.41; Tue, 13 Jun 2023 13:31:10 -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 S241014AbjFMUTV (ORCPT + 99 others); Tue, 13 Jun 2023 16:19:21 -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 Content-Transfer-Encoding: 8bit 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 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) --- 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); -- 2.40.1