Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1232820rwd; Thu, 25 May 2023 09:40:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6KxtjBlHL6WerxcOe+KzzLjG1y0e+P9y/xn6W+PIWemOQBGnaGuESe3q30avFUBDcnQsoo X-Received: by 2002:a17:902:a505:b0:1a2:6257:36b9 with SMTP id s5-20020a170902a50500b001a2625736b9mr2076671plq.31.1685032816216; Thu, 25 May 2023 09:40:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685032816; cv=none; d=google.com; s=arc-20160816; b=Yg8VwMJPGOlPBxzxFaYH9R95/IOZul2JTqknCofxl5mZqDTZvAGyBtrzxO8eEIxjn8 tOWv1XiACHmlqBPHD3qjTv3mbJJ226HjPK22nUn5gxpqJiOBU/p9NGQFd4UYnTyBYxU5 I48V0SIzm6NLjO7uquQ5fD1+Qr2KFz10USCJgWgC6zJ7fkdhXyEqmkVU+hkcPf1+nMSO m5ruxs7xpo4TOWVqbbXKB2nfOzrt6Wj0F7x+FIzo6slPqGi2A5x1cGDWX9NiiB7stv2o FrkUCF4Ypn+aKQG1GnJQC1be+HKCBB+jfPnuAMTzRyQHjL8OlcyFBcXQO8FWBgIuIaTP sOkQ== 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=SNfCUobrUAUA40iHcw/nxcay95zNsz3B8ogepnZvesE=; b=YutyqH6dTfNZVoXvAT+JrtWB64Z2QSZNOI8N6/fDWsMtqJ7bUkxeVjQ2otqaz0YuBJ euCmaHrEIZ3YWLDwtXygfXMlM+fso16vcON9AbfSxaH8a4tjCZjplA5nh6zLp0t9Sq0I FLdIMrinVZdEvrL1j5n/71X0opqWhbjgzT+5Ks76drYMqIgoUC5hhR3ZWYwg1TIVp4Nc /xSkjrUuV05VU7vO/JODsKyNbUnig3stguliUmva3tjmTnZmq6DWdhI8ufqK2aI1aCEo OeqaHmSe6J8VzYkwF5sBE/UfkQehr/f+aCHxEOkaXgLUb9lzghNgHzsOkXYcIl41z88G uoDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=hX9uByaQ; 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 o11-20020a170902d4cb00b001ae4d1c1288si2030554plg.279.2023.05.25.09.40.01; Thu, 25 May 2023 09:40:16 -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=hX9uByaQ; 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 S229646AbjEYQiC (ORCPT + 99 others); Thu, 25 May 2023 12:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235080AbjEYQiB (ORCPT ); Thu, 25 May 2023 12:38:01 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3366195 for ; Thu, 25 May 2023 09:37:59 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4f3a611b3ddso1478514e87.0 for ; Thu, 25 May 2023 09:37:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1685032678; x=1687624678; 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=SNfCUobrUAUA40iHcw/nxcay95zNsz3B8ogepnZvesE=; b=hX9uByaQAh6r7X5V2dES+20lCPIMCD6w+iaY0Oj7clZFaG3SjaSngMzrGlXDwHWFzR 8xr+Ny07W3tUaqCSSj4yeJeeVqij7mvecUolAWpEHfaZdpFY3ULu2JHC6sfO+OA5sHhC 87AY24b8aRCM0dRqEzwlYt+J3n/dHAgHZJ7Lo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685032678; x=1687624678; 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=SNfCUobrUAUA40iHcw/nxcay95zNsz3B8ogepnZvesE=; b=GPa3Jc31fB+i9h8MVbpPnaGy07qKsZz+5kEDWEtKgITliOdkyaQ+HyzY3H7xzGM4yp s5cx7dBn+Z1MaeCd2z/XmFMfXicj0CxLPvKJQJlRZt+5BfCMEVKKu2vilDZOZR97Lfmi 55JXPbSzrMuQcM/GeW3PslAQM7H7ZRbFb7/t6jhQR07dMsPFgMptUm6FipuOKQbk4Adn IVScq4+PozqOJqTgadNDAftV2VK1N4VJ8ldt4ItyS9guAHgOOOWts+b7VztnDI0GYoWD 2902oB9zJXfo3SFEwQyszzx45jrnSCHSGltdmsX+sTL2GN2aWgh4+a9SfLHX7wDu81pw Hmig== X-Gm-Message-State: AC+VfDwnIYjFUhDUosN6junqmgHavyrm5AdGiDD4fHCHdffrNIvgyNA0 GACsUmrnuU40b/o2Uu05DP11MYCTGgpN3rYq7XyeaAE7 X-Received: by 2002:ac2:5630:0:b0:4f4:c6df:22a0 with SMTP id b16-20020ac25630000000b004f4c6df22a0mr868442lff.18.1685032677758; Thu, 25 May 2023 09:37:57 -0700 (PDT) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com. [209.85.167.50]) by smtp.gmail.com with ESMTPSA id p2-20020a19f002000000b004edb8fac1cesm263084lfc.215.2023.05.25.09.37.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 May 2023 09:37:57 -0700 (PDT) Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-4f3a611b3ddso1478491e87.0 for ; Thu, 25 May 2023 09:37:57 -0700 (PDT) X-Received: by 2002:a17:907:a407:b0:96f:5511:8803 with SMTP id sg7-20020a170907a40700b0096f55118803mr1880847ejc.22.1685032321217; Thu, 25 May 2023 09:32:01 -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> In-Reply-To: <3215177.1684918030@warthog.procyon.org.uk> From: Linus Torvalds Date: Thu, 25 May 2023 09:31:44 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Extending page pinning into fs/direct-io.c To: David Howells Cc: Christoph Hellwig , Jens Axboe , Al Viro , Matthew Wilcox , Jan Kara , Jeff Layton , David Hildenbrand , 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 Wed, May 24, 2023 at 1:47=E2=80=AFAM David Howells = wrote: > > True - but I was thinking of just treating the zero_page specially and ne= ver > hold a pin or a ref on it. It can be checked by address, e.g.: > > static inline void bio_release_page(struct bio *bio, struct page *pag= e) > { > if (page =3D=3D ZERO_PAGE(0)) > return; That won't actually work. We do have cases that try to use the page coloring that we support. Admittedly it seems to be only rmda that does it directly with something like this: vmf->page =3D ZERO_PAGE(vmf->address); but you can get arbitrary zero pages by pinning or GUPing them from user space mappings. Now, the only architectures that *use* multiple zero pages are - I think - MIPS (including Loongarch) and s390. So it's rare, but it does happen. Linus