From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28199C433E0 for ; Wed, 17 Mar 2021 02:36:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1BE664F96 for ; Wed, 17 Mar 2021 02:36:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229900AbhCQCfm (ORCPT ); Tue, 16 Mar 2021 22:35:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbhCQCfi (ORCPT ); Tue, 16 Mar 2021 22:35:38 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCC08C06174A for ; Tue, 16 Mar 2021 19:35:37 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id u4so701286lfs.0 for ; Tue, 16 Mar 2021 19:35:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GvkSjbOflTYrrhQW/IujV+Vj77yNYWLHdlNlegrHH4E=; b=ASGp57d2AB3YJwzE0HztUK7znMoqHLdCpnr808cyahGXOlRg55T2zYUWxFwELsX85a rS35PH4RkUyQRe4gbJq52No3U0lb3SmDBGMBrHHk9qd67i95PxSvEvT+Mngdku3IDOLo nnwpKbepa9C5Dlkm18/FC8Ew/qk9tKjgUsJpA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GvkSjbOflTYrrhQW/IujV+Vj77yNYWLHdlNlegrHH4E=; b=s4jKpmmxRt+IGO3O/GvuQCd4RbEs+aG+Wtg9Ir3JzkrmbUyoL/pe2b8hHoTOrPmsdY GYXwJxVKMHFmxADrRfcorvkdPFwPkq8wHblwyjIcyBHckd2VPLxfG+oK+IbDaxH5ylCc OiMKabXsGJNXeKDwOxCMP3096LCBDCmMMvqoLVS5+7SoKzr6XhRymUBKx8JrJ9EpUl+6 N5FD3NhmI0U+p+7PQWH0u1jR5EEVXmQ49Nx7DfW3X33ZJ5aFfGX2sHb0z07d46fw1zZe c/8/nwFNbr8zOHl1QDJeV6JGydl71ww0MW2qqqdXk1jq998dkfnsquBDCiPrZ2FRbpu5 PY6g== X-Gm-Message-State: AOAM530xGEQGie6EnfgUUJXezmhzbBoEz0x6Q9TFb5173s67nRjBI6j4 RlpId9l7gJg0GToH8KoGtZyd5vOQGO6C/A== X-Google-Smtp-Source: ABdhPJzBLKAYWfa6zeUSNfQCsTCCdTZxuMu3yKY8WMSJ8+37czJJ9TQkvMiEUa3g1DbMBspAc4HuJg== X-Received: by 2002:ac2:5509:: with SMTP id j9mr982385lfk.302.1615948535583; Tue, 16 Mar 2021 19:35:35 -0700 (PDT) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com. [209.85.167.42]) by smtp.gmail.com with ESMTPSA id q3sm3017786ljp.98.2021.03.16.19.35.33 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Mar 2021 19:35:34 -0700 (PDT) Received: by mail-lf1-f42.google.com with SMTP id e7so688512lft.2 for ; Tue, 16 Mar 2021 19:35:33 -0700 (PDT) X-Received: by 2002:a05:6512:398d:: with SMTP id j13mr922688lfu.41.1615948533286; Tue, 16 Mar 2021 19:35:33 -0700 (PDT) MIME-Version: 1.0 References: <161539526152.286939.8589700175877370401.stgit@warthog.procyon.org.uk> <161539528910.286939.1252328699383291173.stgit@warthog.procyon.org.uk> <20210316190707.GD3420@casper.infradead.org> <887b9eb7-2764-3659-d0bf-6a034a031618@toxicpanda.com> In-Reply-To: <887b9eb7-2764-3659-d0bf-6a034a031618@toxicpanda.com> From: Linus Torvalds Date: Tue, 16 Mar 2021 19:35:17 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 02/28] mm: Add an unlock function for PG_private_2/PG_fscache To: Josef Bacik Cc: Matthew Wilcox , Chris Mason , David Sterba , David Howells , Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet , Christoph Hellwig , Alexander Viro , Linux-MM , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, "open list:NFS, SUNRPC, AND..." , CIFS , ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-fsdevel , Jeff Layton , David Wysochanski , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org On Tue, Mar 16, 2021 at 7:12 PM Josef Bacik wrote: > > > Yeah it's just a flag, we use it to tell that the page is part of a range that > has been allocated for IO. The lifetime of the page is independent of the page, > but is generally either dirty or under writeback, so either it goes through > truncate and we clear PagePrivate2 there, or it actually goes through IO and is > cleared before we drop the page in our endio. Ok, that's what it looked like from my very limited "looking at a couple of grep cases", but I didn't go any further than that. > We _always_ have PG_private set on the page as long as we own it, and > PG_private_2 is only set in this IO related context, so we're safe > there because of the rules around PG_dirty/PG_writeback. We don't need > it to have an extra ref for it being set. Perfect. That means that at least as far as btrfs is concerned, we could trivially remove PG_private_2 from that page_has_private() math - you'd always see the same result anyway, exactly because you have PG_private set. And as far as I can tell, fscache doesn't want that PG_private_2 bit to interact with the random VM lifetime or migration rules either, and should rely entirely on the page count. David? There's actually a fair number of page_has_private() users, so we'd better make sure that's the case. But it's simplified by this but really only being used by btrfs (which doesn't care) and fscache, so this cleanup would basically be entirely up to the whole fscache series. Hmm? Objections? Linus From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8406C433E0 for ; Wed, 17 Mar 2021 02:43:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3234564F92 for ; Wed, 17 Mar 2021 02:43:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3234564F92 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 917426B006E; Tue, 16 Mar 2021 22:43:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 89F446B0070; Tue, 16 Mar 2021 22:43:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F4236B0071; Tue, 16 Mar 2021 22:43:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 4BBDD6B006E for ; Tue, 16 Mar 2021 22:43:18 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0EEDE181AEF3C for ; Wed, 17 Mar 2021 02:43:18 +0000 (UTC) X-FDA: 77927819676.20.665A12D Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) by imf01.hostedemail.com (Postfix) with ESMTP id 9A4ED20001D6 for ; Wed, 17 Mar 2021 02:43:17 +0000 (UTC) Received: by mail-lf1-f43.google.com with SMTP id q25so674085lfc.8 for ; Tue, 16 Mar 2021 19:43:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GvkSjbOflTYrrhQW/IujV+Vj77yNYWLHdlNlegrHH4E=; b=ASGp57d2AB3YJwzE0HztUK7znMoqHLdCpnr808cyahGXOlRg55T2zYUWxFwELsX85a rS35PH4RkUyQRe4gbJq52No3U0lb3SmDBGMBrHHk9qd67i95PxSvEvT+Mngdku3IDOLo nnwpKbepa9C5Dlkm18/FC8Ew/qk9tKjgUsJpA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GvkSjbOflTYrrhQW/IujV+Vj77yNYWLHdlNlegrHH4E=; b=qNsMSh8kjT4+7Gzw/eEnSrKdzxBxjpvOd189hElrkGnEkYci7jDn5e81aMA7obY3Zl 88k0rwrN1vGXY4JD794Q7t36VX/077O3UkdlACGNKU/RTX2U/7km/OF+9xcvrS34CqVh 3GSTIL6YK7HBqcbuncJIHHCtapRcGXCiVtff+34r5gX6wYnYUkQxBxLkNd2p0tdIl1Ba W3gPx2m2R7D3AFSLwUh433Hryp4oEqdxX6yQ6NBRyxIzKarHQKIVlRcEeGhQZvIXk6nv obhNhwafrjl3RrWGCacQC24wGcaO40zuiNhFkKC1/pDgf9NE2dQc7lPkTsNzeFAkWwd9 5ZAw== X-Gm-Message-State: AOAM530VbF9f+JnYYED7ZmddI24Rhd+NMTz0IiGBXgueGbdb0ZfgBsSq 9wo5m0hz49fmOe56oFcvOFb/S8rBJ1MvNQ== X-Google-Smtp-Source: ABdhPJxXsvLPPIaOTQFdGJlqIWy5mNCiZLa0dyGrJGct8bi3kAcB5Qe9bUP8yZV12FYoUtc35GDngg== X-Received: by 2002:a05:6512:10d1:: with SMTP id k17mr922474lfg.649.1615948995647; Tue, 16 Mar 2021 19:43:15 -0700 (PDT) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com. [209.85.208.174]) by smtp.gmail.com with ESMTPSA id x26sm3242508lfe.16.2021.03.16.19.43.15 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Mar 2021 19:43:15 -0700 (PDT) Received: by mail-lj1-f174.google.com with SMTP id r20so1338914ljk.4 for ; Tue, 16 Mar 2021 19:43:15 -0700 (PDT) X-Received: by 2002:a05:6512:398d:: with SMTP id j13mr922688lfu.41.1615948533286; Tue, 16 Mar 2021 19:35:33 -0700 (PDT) MIME-Version: 1.0 References: <161539526152.286939.8589700175877370401.stgit@warthog.procyon.org.uk> <161539528910.286939.1252328699383291173.stgit@warthog.procyon.org.uk> <20210316190707.GD3420@casper.infradead.org> <887b9eb7-2764-3659-d0bf-6a034a031618@toxicpanda.com> In-Reply-To: <887b9eb7-2764-3659-d0bf-6a034a031618@toxicpanda.com> From: Linus Torvalds Date: Tue, 16 Mar 2021 19:35:17 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 02/28] mm: Add an unlock function for PG_private_2/PG_fscache To: Josef Bacik Cc: Matthew Wilcox , Chris Mason , David Sterba , David Howells , Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet , Christoph Hellwig , Alexander Viro , Linux-MM , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, "open list:NFS, SUNRPC, AND..." , CIFS , ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-fsdevel , Jeff Layton , David Wysochanski , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: exyatpckspju85wuz7beujnmejdi4oyy X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 9A4ED20001D6 Received-SPF: none (linuxfoundation.org>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=mail-lf1-f43.google.com; client-ip=209.85.167.43 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615948997-158250 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Mar 16, 2021 at 7:12 PM Josef Bacik wrote: > > > Yeah it's just a flag, we use it to tell that the page is part of a range that > has been allocated for IO. The lifetime of the page is independent of the page, > but is generally either dirty or under writeback, so either it goes through > truncate and we clear PagePrivate2 there, or it actually goes through IO and is > cleared before we drop the page in our endio. Ok, that's what it looked like from my very limited "looking at a couple of grep cases", but I didn't go any further than that. > We _always_ have PG_private set on the page as long as we own it, and > PG_private_2 is only set in this IO related context, so we're safe > there because of the rules around PG_dirty/PG_writeback. We don't need > it to have an extra ref for it being set. Perfect. That means that at least as far as btrfs is concerned, we could trivially remove PG_private_2 from that page_has_private() math - you'd always see the same result anyway, exactly because you have PG_private set. And as far as I can tell, fscache doesn't want that PG_private_2 bit to interact with the random VM lifetime or migration rules either, and should rely entirely on the page count. David? There's actually a fair number of page_has_private() users, so we'd better make sure that's the case. But it's simplified by this but really only being used by btrfs (which doesn't care) and fscache, so this cleanup would basically be entirely up to the whole fscache series. Hmm? Objections? Linus