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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 A55BAC433B4 for ; Thu, 8 Apr 2021 23:50:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6950F61130 for ; Thu, 8 Apr 2021 23:50:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233035AbhDHXvJ (ORCPT ); Thu, 8 Apr 2021 19:51:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232735AbhDHXvJ (ORCPT ); Thu, 8 Apr 2021 19:51:09 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D682C061761 for ; Thu, 8 Apr 2021 16:50:57 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id l14so1427238ljb.1 for ; Thu, 08 Apr 2021 16:50:57 -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=XLF2Hy47tG/NhXLeWFJjwjLlXpGjFs6Bt2Vh546exGI=; b=U1nu8PCKZ2rC+hNkH/1FtHr0pHi1eBFqU8nKatafLTnVUf8YWjf3+Y9lxaTCmPnC6N 1maOTah5U5Ugwluf4SbyJDC0T/VIm4gmhPdxCSV5suWLxAoQA6cU1UWIC534ya5fYLAp 8IzK2dToo8y36YbKoGVCbAg0EPiSom+ZJL01Q= 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=XLF2Hy47tG/NhXLeWFJjwjLlXpGjFs6Bt2Vh546exGI=; b=TN+8xlCio34zc3hE/UeyerSLKhozt1q/nUOJ3CTcgYr03r7P9xna8YWM61XM6gJO1e umdZgIDQYlv6YRVcGJZef+W0mPKrjr8AesB/WhOB30mc6zhRN/TKbnmwoHJLGFaa2TYb hpVDt/l/p6Ezl91IlVzZjmZwr1R+X73nRkFhhtKv7zd0rCGzBYVXjCMid8xnaJg6rxIv rrLTcpfp2E/E44A4GczNfbZi8azFanO7YhiEB+kn/Cbm8U54Ts8L2Uf9tuzog74Jw0Ld ezxJWh09DDbE22tAxyjjIlwcsqRWFdCzotvNXRGThPvO95v1o7xKpV4ThnzOLZr0Nxxo XKKA== X-Gm-Message-State: AOAM5306TCls8ospuxUVRgK6sA6x+Pk7EqlqGUS5ZTDYIQu1LAnwvx5/ mYUN/G9CcnPoP6sMnrvsswoeadnGDPZeKg== X-Google-Smtp-Source: ABdhPJwT5DrNOoW/zseIfl0VLqLiMbv0n+FPxuFNRGxoZzd20+7Naf8FczN/hCKQy/PWx7icqHxW/g== X-Received: by 2002:a2e:b4b4:: with SMTP id q20mr7539585ljm.45.1617925855324; Thu, 08 Apr 2021 16:50:55 -0700 (PDT) Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com. [209.85.167.46]) by smtp.gmail.com with ESMTPSA id q25sm91751lfn.42.2021.04.08.16.50.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Apr 2021 16:50:54 -0700 (PDT) Received: by mail-lf1-f46.google.com with SMTP id 12so6721877lfq.13 for ; Thu, 08 Apr 2021 16:50:54 -0700 (PDT) X-Received: by 2002:ac2:5974:: with SMTP id h20mr5012619lfp.40.1617925853980; Thu, 08 Apr 2021 16:50:53 -0700 (PDT) MIME-Version: 1.0 References: <20210408145057.GN2531743@casper.infradead.org> <161789062190.6155.12711584466338493050.stgit@warthog.procyon.org.uk> <161789066013.6155.9816857201817288382.stgit@warthog.procyon.org.uk> <46017.1617897451@warthog.procyon.org.uk> <136646.1617916529@warthog.procyon.org.uk> In-Reply-To: <136646.1617916529@warthog.procyon.org.uk> From: Linus Torvalds Date: Thu, 8 Apr 2021 16:50:38 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC][PATCH] mm: Split page_has_private() in two to better handle PG_private_2 To: David Howells Cc: Matthew Wilcox , Jeff Layton , Alexander Viro , Christoph Hellwig , Josef Bacik , Linux-MM , linux-fsdevel , 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 Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org On Thu, Apr 8, 2021 at 2:15 PM David Howells wrote: > > mm: Split page_has_private() in two to better handle PG_private_2 >From a look through the patch and some (limited) thinking about it, I like the patch. I think it clarifies the two very different cases, and makes it clear that one is about that page cleanup, and the other is about the magical reference counting. The two are separate issues, even if for PG_private both happen to be true. So this seems sane to me. That said, I had a couple of reactions: > diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h > index 04a34c08e0a6..04cb440ce06e 100644 > --- a/include/linux/page-flags.h > +++ b/include/linux/page-flags.h > @@ -832,14 +832,27 @@ static inline void ClearPageSlabPfmemalloc(struct page *page) > > #define PAGE_FLAGS_PRIVATE \ > (1UL << PG_private | 1UL << PG_private_2) I think this should be re-named to be PAGE_FLAGS_CLEANUP, because I don't think it makes any other sense to "combine" the two PG_private* bits any more. No? > +static inline int page_private_count(struct page *page) > +{ > + return test_bit(PG_private, &page->flags) ? 1 : 0; > +} Why is this open-coding the bit test, rather than just doing return PagePrivate(page) ? 1 : 0; instead? In fact, since test_bit() _should_ return a 'bool', I think even just return PagePrivate(page); should work and give the same result, but I could imagine that some architecture version of "test_bit()" might return some other non-zero value (although honestly, I think that should be fixed if so). Linus