From patchwork Tue Jun 13 20:18:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 107540 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp808107vqr; Tue, 13 Jun 2023 13:33:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4TioMDKHnh4tnehwV7cS58IDnkMshqCtqSTjhWV9Ns/uJ9gPM7d1LK3mUa/gr/NwkBOt72 X-Received: by 2002:a17:907:5ce:b0:978:6e73:e837 with SMTP id wg14-20020a17090705ce00b009786e73e837mr14733384ejb.4.1686688387581; Tue, 13 Jun 2023 13:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686688387; cv=none; d=google.com; s=arc-20160816; b=PA28TST9pMSNlKLhHu94hAIdJbYbh67fg52K5IMIDzGAhkYlGCExTZ07iGKA7ywCwY BBnBlRFuct4uRs/XYjkGlldvh4aUoTDaA1mP3ZFp665fOQw65F/I5epwz0No/HAk2lGx E6pv8REXLG13vqcs+6mQOEU6C0ESJblk1MHYETxrIHJWP1ceSqXTJ7FjrbGeT0KhQNq/ o8lBrsvZot5ijrnp9TW9fbCIn9hg57IiOUcCYfraGZ7fk8bWvwQVJYgyHRSRposSRfmg irs7wTq/vpa7HNR5PaLCjiEIandLead9fXWZky+zVl00ujKj9iD+9GlQH8xeZKZRD77u juVA== 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=j2ucc+f0rqtwOxEosVf02SFuSdHsKj1rPS4dOdWYv3M=; b=hVRz+OGeoIuUQWqukn0waImcZDMnLSBHvQwKVDbvJRvyELxUofR4Z8l3AdKtnArLL9 H/q8nyktnv05UMrNkg9mrp0QT62hhNFL3UOlrneR2b7fX/krxEH5g26acH/fM82d3AxD 1q7RuXPJ5pvPnMF+JedqNW7hBo5R3yILQPyCio4xSdQ5nJRCdQV2f+sdZ+lQZB18vfix S4hFTfxEvG399XZGrv6YrQk+3FeH1cN4xVCnx0j6aglu9jWkrbR/elxPRQP8Zc1ySIwR 8Ggs85mwKm4n3832R8vKTTEZxU3/UEbif+BmOzOJDnh6sdlhntbsj6OQwa8znJkrykjV g93w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=NnMuaE5f; 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 k19-20020a17090646d300b009786e7e398dsi7352663ejs.216.2023.06.13.13.32.42; Tue, 13 Jun 2023 13:33:07 -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=NnMuaE5f; 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 S239719AbjFMUTJ (ORCPT + 99 others); Tue, 13 Jun 2023 16:19:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240833AbjFMUSw (ORCPT ); Tue, 13 Jun 2023 16:18:52 -0400 Received: from mail-yw1-x1134.google.com (mail-yw1-x1134.google.com [IPv6:2607:f8b0:4864:20::1134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BE2326A5 for ; Tue, 13 Jun 2023 13:18:33 -0700 (PDT) Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-56cf6f4211aso42796507b3.1 for ; Tue, 13 Jun 2023 13:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686687513; x=1689279513; 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=j2ucc+f0rqtwOxEosVf02SFuSdHsKj1rPS4dOdWYv3M=; b=NnMuaE5fk1vnz0fpTjn9UjrZgJHsXMRl+F9w4UFv+tzg5DBYIlhgiytt2snvQ9zSe7 gVKwKEZKKxzSBrmp0fKKFerObVTJVP6JNF5MBYHkHNmOlwnYVV8DyqjmhkTNlKzmNpbs pDD7gCQVreZak+djhqexShCA06em1AFUDv5Y9/+1SgxJYtl5YPM6NiWsRxJG+6xI9Etq KEH+EPITLv3sh/bc+uNUz3LHDQcDdC1dboyu86Fxj8dHSj0tvP9++JRCGcc29XEzPgX9 WPQeLh1tPySTTLmcvLYz3Q242bF+SGdNkd9csYATCx8q/D9Q9DmnHHKYh/besnCgghXg FHnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686687513; x=1689279513; 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=j2ucc+f0rqtwOxEosVf02SFuSdHsKj1rPS4dOdWYv3M=; b=AGoFpTu80GKtQrQnyZ8eX2KNmYrqZHdqleebgP1cV08xKsjb/5rXp8bbg4wTPxnLnp O5p1fauyyXlfla6cRq/MhLG8doKIg0gdZzrn6F7UDertqYXEmbqSg7CvtHmTQmTTJ61g Vdf95hm0Fwte/Z1SlNDrrUxwA1iIg5/99jviIIGsKkZP2H4SjG0cLzFoB4fdgvIunDC6 EjaJ0IkvZaZNo0a/4l+D4OzQjsCUNSLVHDXW3YLytiPaFAYMgqfVQqsG70JfuMgLwiPf N+1J/W/wD2y49bSd9m501AsfTAUZM63zG4ZwPMveMhuFMB6q9Ba4IuTunw4I5ImsLP9S LGNw== X-Gm-Message-State: AC+VfDz6LdjOeHeuFlFiA5Omjm2egE6wIn+wV4yO2qkMbsFR2jC/7y50 AAJYgmx2P8SzRfunSprkjtbmdtJlVTIATg== X-Received: by 2002:a81:b406:0:b0:56d:495d:d3f6 with SMTP id h6-20020a81b406000000b0056d495dd3f6mr2888725ywi.29.1686687512728; Tue, 13 Jun 2023 13:18:32 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 13:18:32 -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 1/5] mmzone: Introduce folio_is_zone_movable() Date: Tue, 13 Jun 2023 13:18:23 -0700 Message-Id: <20230613201827.9441-2-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?1768620962307398786?= X-GMAIL-MSGID: =?utf-8?q?1768620962307398786?= Introduce folio_is_zone_movable() to act as a folio equivalent for is_zone_movable_page(). This is to assist in later folio conversions. Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Matthew Wilcox (Oracle) --- include/linux/mmzone.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index a4889c9d4055..744bf32e48a8 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1116,6 +1116,11 @@ static inline bool is_zone_movable_page(const struct page *page) { return page_zonenum(page) == ZONE_MOVABLE; } + +static inline bool folio_is_zone_movable(const struct folio *folio) +{ + return folio_zonenum(folio) == ZONE_MOVABLE; +} #endif /* From patchwork Tue Jun 13 20:18:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 107532 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp806975vqr; Tue, 13 Jun 2023 13:30:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Q0oSh8UATU7VASD4ZazANSAaQRGu3UNhY2dXwZQlzd3+xJN+O68kSNZks8nrwchbV3gSz X-Received: by 2002:a17:902:a983:b0:1b3:e6ba:1575 with SMTP id bh3-20020a170902a98300b001b3e6ba1575mr2727028plb.16.1686688254846; Tue, 13 Jun 2023 13:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686688254; cv=none; d=google.com; s=arc-20160816; b=RNwIQWeFMQ2usscyLzisQTZVd2+u4oQEqOiI///IIaLCYfUMsl8wWs2mvrpHmn90FU noXCLYYXLD/p7Uk+lOdJQZodBycYc1Fp3Np6GSScb8r2NoY+jX8xVVbLqCBnAGGN0Afd q5m8MTLNd2yxOF0A2SZm6oGBg7Cgtylth/RiMkZGb4Gytge6avBCA3yw/aUCaDygaILb UxwscAvGt4SE3HX1590sbxlvDKdWlJEJ61zvOEyJxTsgk4ryWQCYBVKc7EXVLCPb2oOj iSbVaNC8ScZH1OSttLizdwcTK6wrg2M092CebZIJ4cwu9qT7pHvTBUCAdTTwmx6nBIFA pEng== 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=U6KHUky1DpkusNGgmBNXNnpcQ1dWjAR0pkWJnKeXby4=; b=olI/b/wne8x7ShY26EV4WaQBRw8OZnmiqtAT6NzIbievvUCAEuDTqzKtPQJVeg17E5 vk9aB0LVUuZY3CdZkRVFx7cr6spyuPiGW+lO/esIeTZUHFuEZcqKNdBy0F7/oNA8Uwh4 BVFynbTVDG8lZXCt39+C9J7GUtThJXOt940s3T/XY9PilRnh+5r0VwWJCRwxLjbp/qwL DWAPb/r3ZTFvmdBE2w5gF620nbIUFS1MwE7juWnN6UjD1YHm6INAeBHbFK7TkSSLcvbE Ja4fXm1zDb/JEga6vZ071bPXfnyAw3oXm3YzZoOr2hZiZrWLWXSJKzbTKLb6l2gmPDGw hZuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=K51pHP9w; 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 kz6-20020a170902f9c600b001aaf8182cc7si4734873plb.425.2023.06.13.13.30.38; Tue, 13 Jun 2023 13:30:54 -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=K51pHP9w; 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 S240920AbjFMUTO (ORCPT + 99 others); Tue, 13 Jun 2023 16:19:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241050AbjFMUSz (ORCPT ); Tue, 13 Jun 2023 16:18:55 -0400 Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D720E1BEA for ; Tue, 13 Jun 2023 13:18:34 -0700 (PDT) Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-6b291d55f52so3333885a34.2 for ; Tue, 13 Jun 2023 13:18:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686687514; x=1689279514; 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=U6KHUky1DpkusNGgmBNXNnpcQ1dWjAR0pkWJnKeXby4=; b=K51pHP9wViB3ZadMEXzWsfIDKin1lsEdjUYjh4DAwZ9sRHvdPjCCPf9ICl06aw5cUM QCRpWcyMMeWIyke9qqZO0B0qjy/mN6tyRAheWiPYKE6boBZfSeHb/3glWNTAVPHzvltu anwJ3GiEbzQXjjlDk2g9eGm7zSJB9xg+Ehl/JjSyVxyt9Y93aNsoDxx7HWS9aKOTwE0s 7XtO9aZwf6Lem17hnmOg8y48qHKRxU5qXgoihMMzOSYzowYHUNkGTr0uuTOGdw4cTmks K7jkvCu8YCPUkTvNSDe4dX/b+Fbp7pNGPckvp3MXIBC/7nzzhr6wE2Hs9UBoSHWI0pon 8/6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686687514; x=1689279514; 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=U6KHUky1DpkusNGgmBNXNnpcQ1dWjAR0pkWJnKeXby4=; b=ka4FxCPqVpY5UaDo0frxHIBIjBNBiTh9IUzbfP/Es22Z+bIXlyx8oZqvUHYzxdWPi/ pDoL+ppMabHBXi8eVzgf2squlKZE2GylXPg3b+/bDxQ+89W0S+KmF2p+q7QQhT/IJuwz yiS/rIgFXPI+gLoSPTGjYRfzEI15ynjEMwk7vtPBoLPkqM1gkuIi/tam0XU9rxSnNhpZ iVmZH2FlsRJz2FhZ6RRBraxwyinZGVRWSZeyj856HDIR5YBoW7nAnCHTwpSa1vS8Ox8X T04Me5Ic0al5UzY1cEDhY7xDU7n1U4SHxij3ITQkui5lAfX4Lc5JskCeWp/0rhsJ9MT1 YfEw== X-Gm-Message-State: AC+VfDw4VS1qCBNn2rFbzmMS9QgX8iBtbgUUZxBEPT4FLX5uL+woUADr bmI7D1fhPFJaETRucknKocs= X-Received: by 2002:a05:6358:e813:b0:12b:dce7:f428 with SMTP id gi19-20020a056358e81300b0012bdce7f428mr5201292rwb.1.1686687513897; Tue, 13 Jun 2023 13:18:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 13:18:33 -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 2/5] mmzone: Introduce folio_migratetype() Date: Tue, 13 Jun 2023 13:18:24 -0700 Message-Id: <20230613201827.9441-3-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?1768620823648934570?= X-GMAIL-MSGID: =?utf-8?q?1768620823648934570?= Introduce folio_migratetype() as a folio equivalent for get_pageblock_migratetype(). This function intends to return the migratetype the folio is located in, hence the name choice. Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Matthew Wilcox (Oracle) --- include/linux/mmzone.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 744bf32e48a8..b58c76e68ac7 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -105,6 +105,9 @@ extern int page_group_by_mobility_disabled; #define get_pageblock_migratetype(page) \ get_pfnblock_flags_mask(page, page_to_pfn(page), MIGRATETYPE_MASK) +#define folio_migratetype(folio) \ + get_pfnblock_flags_mask(&folio->page, folio_pfn(folio), \ + MIGRATETYPE_MASK) struct free_area { struct list_head free_list[MIGRATE_TYPES]; unsigned long nr_free; From patchwork Tue Jun 13 20:18:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 107539 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp808002vqr; Tue, 13 Jun 2023 13:32:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6TPw0G/XdKkpaQtcUhY6pZEb9uNSa3S27AyHV4y8ciD6ItDnYF9Vn3yCVeduq2Zvx9pjnz X-Received: by 2002:a17:906:fe0c:b0:976:b93f:26db with SMTP id wy12-20020a170906fe0c00b00976b93f26dbmr12343244ejb.53.1686688370712; Tue, 13 Jun 2023 13:32:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686688370; cv=none; d=google.com; s=arc-20160816; b=R2/2U+sxyEkFhT0dCZDED8iTJjcJpR4d8UQA81ajRcBPS+6GhsQ7GhjqjJ7IHJiJru zlIJM0AIgKs2gd71LZLxdOleEDgI6VUwR7UGrZ0ReTlEgk09Kt21NOTIf4wdYUomrITe Lz3ybqDZnXdTW2B7C9jnIouhPSAde7ODs7cV/gtAX3sDkR69cegX/YdXi19CDlVZ06Be mNLsnJU0AxytHOSrjNKuuTH17W52Qe8j3uKWWLlhLajH7oz+rfPMDXn52pOK7hRWxJVT 0YrSb5zBEQrFbAXX/RAY7z+19D1z/+L7HN6V+GFPL1ydwchrxOHu1mDj8L14AH6/VifM 9kiA== 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=bo5mmyxvl0eErY9pWIIhlP2v8r+RpR3JWxAmafCgaaA=; b=US8E9yDufRdMONsTiZ56ewuNyvH6IdGfjtDAedEreI1WG7iXp2bdn8AfsFwlu6B+po R1YmGX56UkXuIgCHlm3csdD9wfCdMxtPVybzIepW7qnlygzzzcXLlfjDVz1yCk3eqfDT cTwGLFe58fgY0uti12DZfjpl0f584agL6r3U86LATc6sRiMsbu1mgjMskBgBjXzsihGp ubyQUQ6YidGx/vHy0/W8ANoPq+7Hd/xVBCDQoxoyUTlfpnYZ15chIows27pnD4tJVFtQ f+yaSVloWT8TcVSjRbDhzvhQQ7M4vHOg70RoG4AeSiWZyb5VfWRom2Rhk1lEA9k3lD+t /bFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mq+xPQwa; 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 uz25-20020a170907119900b0096a3525cb1fsi7580850ejb.166.2023.06.13.13.32.25; Tue, 13 Jun 2023 13:32:50 -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=mq+xPQwa; 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 S240367AbjFMUT2 (ORCPT + 99 others); Tue, 13 Jun 2023 16:19:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241069AbjFMUSz (ORCPT ); Tue, 13 Jun 2023 16:18:55 -0400 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAFD41BE3 for ; Tue, 13 Jun 2023 13:18:35 -0700 (PDT) Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-6b162fa87d8so3295040a34.3 for ; Tue, 13 Jun 2023 13:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686687515; x=1689279515; 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=bo5mmyxvl0eErY9pWIIhlP2v8r+RpR3JWxAmafCgaaA=; b=mq+xPQwaOKwXksJ8eIOgdN3s569QJ0hElDZw9QHnYu3dnpIe0Od4y3M6EvPuXCbYcW 0PCN59K8kIoHsrBj9GKTgCoqWqxEo1BJpDu82hVYNvrIXokkvOlwvl6qRQC8sus+P6g/ ezx6HULqCegZHyQwScdJYf7E+SlqcD6XLy/1xMzHxMinGkOLKi01dQe2/NKQO/hJPRPj oH1arSzrLT6pfQ73f4Ay/jE7vGARCFLtpJMd3sSd8TNqL4owBma2eW+iaryCuuvtKVib GFPFMn5bRjH7YA5iJyJT7x6df7yBL/bNziEY1Jv8CK+8aC+6sK6L5ZgtrbGx/ClhN8vr 6Q5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686687515; x=1689279515; 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=bo5mmyxvl0eErY9pWIIhlP2v8r+RpR3JWxAmafCgaaA=; b=Lolkin1mDHciPFzWyWXAC7sd801C/On5Pi+TcsiFOiY0mW9dHAkwtWuSNTf1Gea23v 93PjWLviBUTz8fEe7pVLUsthgTjOFNacMXaV+rIw8N69PL8A1Z/fFNvDqi42HjmoePUX BGVCuZIASoFgq9qCy5+ouSzuLMCf2ToyQVdr8mGKSeJee9cGvlHbwMw/eLC+PvCNVVmH 2yR3KkxIais1FnCal2AK9mfMXhEqYtdLtYz6iKNYumiI3yvHdp5d8Qo0Ng+b92RCQB20 s9U2QXypyz7MjhbrsRej6PEwq3zCn25o2F2PBEwhFz8r8RO/45b0mxPtlwpK4se/hBvf 6PPQ== X-Gm-Message-State: AC+VfDzV9R5acNwr/6V2vIZt27mqKkiAKw6itkq5VbjfiiWamnz+4GVO NI15F3HjLrBfCwkFX4xEJZg= X-Received: by 2002:a05:6358:9dac:b0:129:cf11:6b2a with SMTP id d44-20020a0563589dac00b00129cf116b2amr3722960rwo.3.1686687514875; Tue, 13 Jun 2023 13:18:34 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 13:18:34 -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 3/5] mm/gup_test.c: Convert verify_dma_pinned() to us folios Date: Tue, 13 Jun 2023 13:18:25 -0700 Message-Id: <20230613201827.9441-4-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?1768620945301681679?= X-GMAIL-MSGID: =?utf-8?q?1768620945301681679?= verify_dma_pinned() checks that pages are dma-pinned. We can convert this to use folios. Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: Lorenzo Stoakes --- mm/gup_test.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/gup_test.c b/mm/gup_test.c index 8ae7307a1bb6..860b093b4b3e 100644 --- a/mm/gup_test.c +++ b/mm/gup_test.c @@ -40,24 +40,25 @@ static void verify_dma_pinned(unsigned int cmd, struct page **pages, unsigned long nr_pages) { unsigned long i; - struct page *page; + struct folio *folio; switch (cmd) { case PIN_FAST_BENCHMARK: case PIN_BASIC_TEST: case PIN_LONGTERM_BENCHMARK: for (i = 0; i < nr_pages; i++) { - page = pages[i]; - if (WARN(!page_maybe_dma_pinned(page), + folio = page_folio(pages[i]); + + if (WARN(!folio_maybe_dma_pinned(folio), "pages[%lu] is NOT dma-pinned\n", i)) { - dump_page(page, "gup_test failure"); + dump_page(&folio->page, "gup_test failure"); break; } else if (cmd == PIN_LONGTERM_BENCHMARK && - WARN(!is_longterm_pinnable_page(page), + WARN(!folio_is_longterm_pinnable(folio), "pages[%lu] is NOT pinnable but pinned\n", i)) { - dump_page(page, "gup_test failure"); + dump_page(&folio->page, "gup_test failure"); break; } } From patchwork Tue Jun 13 20:18:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 107529 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp805268vqr; Tue, 13 Jun 2023 13:26:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6X3xlc5gwDo+kT+wgUk4qFiDPdHqTCo2XmWd9i8JtWT+fpukcKB6uT7vcnGY/bFjvtbKtm X-Received: by 2002:a05:6358:9f8f:b0:12b:c390:8ca3 with SMTP id fy15-20020a0563589f8f00b0012bc3908ca3mr5788327rwb.21.1686688003520; Tue, 13 Jun 2023 13:26:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686688003; cv=none; d=google.com; s=arc-20160816; b=rQTvPk2Ifk8KFuMKZ1ZAxN0ql/FNR0X4zvjREbuyXc0+u90ZvEurhLBn+Ogn/ZZ4vK q287Qki2k743YJgwqWkZlmFWQocDRESwwu6iAHdxszOxwBUPcAG+zGciG+DhkRi1mbgF 2w+qQr5lvmmkBue1QGJSUI1N7HjmgIaOqhjM7A4FVTCltNoCHYgSJZ1umeQ7GuUByfNI ead4nIc5rODUx/iqaPt2Dov/o0HKU1dzDt5b7HyeEePsFqhhsX6Ky7sCyRAHwpGux2qx cvHoVpq/0Fp8xR14XoeosPlrJHzPN6NzIjbnt5oo/X286B9b818NIbgMSPDII1ApXAnW OiOA== 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=amkbPFI+P7Pfwa/Tib2X8h1et/cH9zCscfc2pych/Qg=; b=y2TLj6I2Vier7NT/k/7BjEjeqCOPvIDWfwbYGEKFkxtUY8w2294Az5/QKqfBKzF3Dt RkPH63m7MCkVahSE3mGG7BQuUaO2OFXOx9WPoABh6oYPEGk91mRL7aXufy2gME3jnWAN CXoV55pofxMGiqvRy63upZFiOX48vfrfkAAJsiMM+fPzWiQ5KC5Udg+eKAcUlq/exU/J NY3/nLIxliNzgpbVgzHs6BP/ZdIUhUBD6thC/+qU4wkWe2k6guapr86o5Hbh+fJX+C1z NeX2JzEvr8H0yJfZzUXKvgeYKGEKqXpXeXabou7v4TGTgIvMnCtCdYGawXwwIlQMK7yX Zj7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=MAhhKx2u; 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 u123-20020a637981000000b00524eef20da6si9632892pgc.642.2023.06.13.13.26.30; Tue, 13 Jun 2023 13:26:43 -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=MAhhKx2u; 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 S241048AbjFMUTY (ORCPT + 99 others); Tue, 13 Jun 2023 16:19:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241102AbjFMUSz (ORCPT ); Tue, 13 Jun 2023 16:18:55 -0400 Received: from mail-vk1-xa2a.google.com (mail-vk1-xa2a.google.com [IPv6:2607:f8b0:4864:20::a2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E98226AD for ; Tue, 13 Jun 2023 13:18:37 -0700 (PDT) Received: by mail-vk1-xa2a.google.com with SMTP id 71dfb90a1353d-45d3e523a43so2465178e0c.2 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=1686687516; x=1689279516; 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=amkbPFI+P7Pfwa/Tib2X8h1et/cH9zCscfc2pych/Qg=; b=MAhhKx2uS7CtxHxYidopGlbP50mkEqVOHFIPJKoj5ZOU1awqmCAZySq2DuJ4PVyvwg NDzdpU61axPHkbgwy/Y2ElyR0ktqDf33BW1AKFl/xU7NB5LA46T0GJmHmkvZXBDKcPcl kYmptMQ0XgUVBW119yk0+pHJJeUdN2rQvdUbCPLskahLtJ1NDrGQk09ZYYQROPT6i5kH XjdwUoPGnkS5/pQJyWEzn6WBdetGabgHMrCzlwO0Ziqalg0ukpQbM8MFXCzLE5iPi596 3rcpmemEQcFBBqrfIWtEwnuM0nbjB8OD5Xlal27Ey2acFTT8jaHFTkIo/BYOwcK8NDny wVjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686687516; x=1689279516; 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=amkbPFI+P7Pfwa/Tib2X8h1et/cH9zCscfc2pych/Qg=; b=VA2808r2IXv2sx8LWPZc2QryQ/jjMMRLJq4YXVJzxcpo2w/NNTyNUpNP21Ld3DemIO xLcWmlXKmNyBKguAGq2C83FoJe4OiOhu1M9A2VBvmKYOCYlFz5ILS/2zRKbsU/nXy/WA /8ciWzdIBW4SrCYDkma6gcmy3c40soeDvMHXwcnmex978vxPl2TuGmiSUYXvTlxCdEgV shvLjAXTdq29iH89+IGaP1nbN10C5RKHJPyPnmeLMFPOJHdxwAEuAPTxgBkuHHawOgtO n+GQyRp/a9kcKKq5pPpNIdKfT6qWjW/pr6g8EhocUReNNEX+oZl8HxNWQcayKYDc3GJG ZLAw== X-Gm-Message-State: AC+VfDyAWO5H8eTofOxgWRB34czCxx3JAzcutuebgdpR/5+jEpSiXbEn wGppLR+LBSLyijKzcO8TU8I= X-Received: by 2002:a1f:5f4d:0:b0:46e:70f8:c8ef with SMTP id t74-20020a1f5f4d000000b0046e70f8c8efmr1653501vkb.13.1686687516019; 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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 13:18:35 -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 4/5] mm/gup.c: Reorganize try_get_folio() Date: Tue, 13 Jun 2023 13:18:26 -0700 Message-Id: <20230613201827.9441-5-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?1768620559618105101?= X-GMAIL-MSGID: =?utf-8?q?1768620559618105101?= try_get_folio() takes in a page, then chooses to do some folio operations based on the flags (either FOLL_GET or FOLL_PIN). We can rewrite this function to be more purpose oriented. After calling try_get_folio(), if FOLL_GET is set we can return the result and end the function. If FOLL_GET is not set and FOLL_PIN is not set then it's a bug so we warn and fail. Otherwise we simply proceed to pin the folio and return that as well. This change assists with folio conversions, and makes the function more readable. Signed-off-by: Vishal Moola (Oracle) --- mm/gup.c | 88 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 42 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index bbe416236593..adbd81f888f5 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -123,58 +123,62 @@ static inline struct folio *try_get_folio(struct page *page, int refs) */ struct folio *try_grab_folio(struct page *page, int refs, unsigned int flags) { + struct folio *folio; if (unlikely(!(flags & FOLL_PCI_P2PDMA) && is_pci_p2pdma_page(page))) return NULL; + folio = try_get_folio(page, refs); + if (flags & FOLL_GET) - return try_get_folio(page, refs); - else if (flags & FOLL_PIN) { - struct folio *folio; + return folio; - /* - * Can't do FOLL_LONGTERM + FOLL_PIN gup fast path if not in a - * right zone, so fail and let the caller fall back to the slow - * path. - */ - if (unlikely((flags & FOLL_LONGTERM) && - !is_longterm_pinnable_page(page))) - return NULL; + if (unlikely(!(flags & FOLL_PIN))) { + WARN_ON_ONCE(1); + return NULL; + } - /* - * CAUTION: Don't use compound_head() on the page before this - * point, the result won't be stable. - */ - folio = try_get_folio(page, refs); - if (!folio) - return NULL; + /* + * CAUTION: Don't use compound_head() on the page before this + * point, the result won't be stable. + */ + if (!folio) + return NULL; - /* - * When pinning a large folio, use an exact count to track it. - * - * However, be sure to *also* increment the normal folio - * refcount field at least once, so that the folio really - * is pinned. That's why the refcount from the earlier - * try_get_folio() is left intact. - */ - if (folio_test_large(folio)) - atomic_add(refs, &folio->_pincount); - else - folio_ref_add(folio, - refs * (GUP_PIN_COUNTING_BIAS - 1)); - /* - * Adjust the pincount before re-checking the PTE for changes. - * This is essentially a smp_mb() and is paired with a memory - * barrier in page_try_share_anon_rmap(). - */ - smp_mb__after_atomic(); + /* + * Can't do FOLL_LONGTERM + FOLL_PIN gup fast path if not in a + * right zone, so fail and let the caller fall back to the slow + * path. + */ + if (unlikely((flags & FOLL_LONGTERM) && + !folio_is_longterm_pinnable(folio))) { + if (!put_devmap_managed_page_refs(&folio->page, refs)) + folio_put_refs(folio, refs); + return NULL; + } - node_stat_mod_folio(folio, NR_FOLL_PIN_ACQUIRED, refs); + /* + * When pinning a large folio, use an exact count to track it. + * + * However, be sure to *also* increment the normal folio + * refcount field at least once, so that the folio really + * is pinned. That's why the refcount from the earlier + * try_get_folio() is left intact. + */ + if (folio_test_large(folio)) + atomic_add(refs, &folio->_pincount); + else + folio_ref_add(folio, + refs * (GUP_PIN_COUNTING_BIAS - 1)); + /* + * Adjust the pincount before re-checking the PTE for changes. + * This is essentially a smp_mb() and is paired with a memory + * barrier in page_try_share_anon_rmap(). + */ + smp_mb__after_atomic(); - return folio; - } + node_stat_mod_folio(folio, NR_FOLL_PIN_ACQUIRED, refs); - WARN_ON_ONCE(1); - return NULL; + return folio; } static void gup_put_folio(struct folio *folio, int refs, unsigned int flags) 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);