Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1304188rwd; Thu, 25 May 2023 10:36:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5GHHRL5nioxYunXTBD70pjjKmOtk94dw6OttcpfEc9UY0Ntxzmz4KosLn2losdWx6fGap2 X-Received: by 2002:a05:6a20:4327:b0:10d:f812:e4b5 with SMTP id h39-20020a056a20432700b0010df812e4b5mr6655330pzk.35.1685036167341; Thu, 25 May 2023 10:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685036167; cv=none; d=google.com; s=arc-20160816; b=EyOWpD3X3NocQIcOX/dQ5UF2c41r9j6w3sG0vwGzvbn1MWSFmobUVFYNw0Y5n7kd8g E8yd9t5sDwB2zO3HhQeNGY//krMwwnwRDuCK8bNmAeFfQgF+kxdHTuAw7ucB8G0S29GR sZYwAKE+Mv5lt9qZUpUOmLeqOttHVmouJx7Zczh1b08ymJaAVo9k8EKI9+AJRdtUZXRH tBcWu3y+5+pLJBKHQst7HQyUzuScd+jb5YUtMaiYs6hSEnBRScibjovZi1xKT4Mwwa22 BQXB0DbNR48glrMIa+MwiMOAz8F8D0q74YOi0TI9TN4xYtsfTHiskZ9zSYRTn4TkHdoV iuUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=EJa+li1Oy5bbsqG6UFm3MUpvaFnPsLyMyN5vhg0qjCI=; b=hlZlK8bumbnDN+w698CWTVylXIfCBtQetdOTnc9jZgx6EAfzsxf1vXn1KUfAHpY62+ zi8nSIR9EvYcw3OjI8Ag0bpiMaZi+B4ZEiGnOSrqi7kD4BJyDO3n8/wUson2YlIoKIUB bS02NN4/RAn1CgMouFgogMPlV4P/quqvfpAbydpnaVfLca5ddNk9zowDBNmvFjUocdeU 2SJKM6HwkQkS4uJbAjhpE9bgXjTTUMKFarPkq+AKFA6M1oJkS634T9rYjBmXjZ/8lcBK BQIXtTiU1fpiy7EXkFSvKvNDey825fCT7StGyHzbB3XLOorJMAUDn33LD6m9n0/Ol9yb uCew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Ok2oHq3c; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020a63b904000000b0053094305b59si1604147pge.875.2023.05.25.10.35.49; Thu, 25 May 2023 10:36: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=@linux-foundation.org header.s=google header.b=Ok2oHq3c; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234068AbjEYR0J (ORCPT + 99 others); Thu, 25 May 2023 13:26:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbjEYR0H (ORCPT ); Thu, 25 May 2023 13:26:07 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D2EA199 for ; Thu, 25 May 2023 10:26:02 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-51190fd46c3so4316986a12.1 for ; Thu, 25 May 2023 10:26:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1685035560; x=1687627560; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=EJa+li1Oy5bbsqG6UFm3MUpvaFnPsLyMyN5vhg0qjCI=; b=Ok2oHq3cev+oksqRUcG1p3USoN99IbgxduJYBtiM1ZppktJCef7OJEAeTtiFyV4Pla ualjpqrKd+WIl8n4NZV9wQWuCy1d7zew36uRaxySx+XcHvwZotJwo3OYIopLB4A7A7Jg Af69GCES8xqOENGnIFKoV7WULD0sjK3aGPWqU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685035560; x=1687627560; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EJa+li1Oy5bbsqG6UFm3MUpvaFnPsLyMyN5vhg0qjCI=; b=cgAKW/MhOKrhePkKg+dHOXikcT4pOUoqiflrUztMMUEACI6dxVWFhgnxKlyBd3OKDo ZSCgbvVUKarg3BaHEfu1b7gLY6lbIH5hpf5XuE1S2aw2AI2EKJl7hZfwXxAU7TlvgTpL DKufQtu2tRcdFkW1fOTZ/QVg4Q2akxCyEUPe060X/ymKzMoJrOhLPxk6J8NBBjpMYgXn sNkyGpN4qbQ2mJgOmsIJ6+eaRCAYvhKQ+OUpIxrRf8U1N3mvZQJbd533ToEzwzIb+5ov w7NTmUm4eJeB9MaS3rn1jRa/a70cNRqUkViyYyiDEvg7f2hP5eOIGZUpTqSt4/Ucjexc BmYw== X-Gm-Message-State: AC+VfDx6jxJw6TKdMnt0bWEX0Atw4HeVruMxJLKWdj0FwQ1i5KmB4ONe 2ImbTEHQYCyD/e2esWgu2gCwf2V8V1swq51f6uqtZT22 X-Received: by 2002:a17:907:7204:b0:971:484:6392 with SMTP id dr4-20020a170907720400b0097104846392mr2447535ejc.38.1685035560775; Thu, 25 May 2023 10:26:00 -0700 (PDT) Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com. [209.85.218.51]) by smtp.gmail.com with ESMTPSA id u24-20020a1709064ad800b0096f67b55b0csm1107050ejt.115.2023.05.25.10.25.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 May 2023 10:25:59 -0700 (PDT) Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-96f8d485ef3so143082666b.0 for ; Thu, 25 May 2023 10:25:59 -0700 (PDT) X-Received: by 2002:a17:906:7954:b0:96a:37af:ff37 with SMTP id l20-20020a170906795400b0096a37afff37mr2274160ejo.15.1685035559397; Thu, 25 May 2023 10:25:59 -0700 (PDT) MIME-Version: 1.0 References: <20230522205744.2825689-1-dhowells@redhat.com> <3068545.1684872971@warthog.procyon.org.uk> <3215177.1684918030@warthog.procyon.org.uk> <144598.1685034915@warthog.procyon.org.uk> In-Reply-To: <144598.1685034915@warthog.procyon.org.uk> From: Linus Torvalds Date: Thu, 25 May 2023 10:25:42 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Extending page pinning into fs/direct-io.c To: David Howells Cc: David Hildenbrand , Christoph Hellwig , Jens Axboe , Al Viro , Matthew Wilcox , Jan Kara , Jeff Layton , Jason Gunthorpe , Logan Gunthorpe , Hillf Danton , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no 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 On Thu, May 25, 2023 at 10:15=E2=80=AFAM David Howells wrote: > > It doesn't seem I can add it to mm.h as an inline function. What? We already have that pattern inside is_longterm_pinnable_page(), so that's really strange. But regardless, please don't duplicate that odd conditional for no reason, and don't scream. So regardless of where it is, make that "is_zero_folio()" just do "is_zero_page(&folio->page)" rather than repeat the question. I also wonder whether we shouldn't just use the "transparent union" argument thing more aggressively. Something like typedef union { struct page *page; struct folio *folio; } page_or_folio_t __attribute__ ((__transparent_union__)); and then you should be able to do something like this: static inline bool is_zero_page(const page_or_folio_t arg) { return is_zero_pfn(page_to_pfn(arg.page)); } and we don't have to keep generating the two versions over and over and over again. Linus