Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1159692pxf; Fri, 9 Apr 2021 01:15:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwr1JtyZ6seiZ9SM3mOUQb6vEga5GJAcM7M5Fu5OGIzJfoxQ2vPD2+vr0wiijBj42rgg/dq X-Received: by 2002:a17:902:446:b029:e8:c376:6651 with SMTP id 64-20020a1709020446b02900e8c3766651mr12227980ple.72.1617956140142; Fri, 09 Apr 2021 01:15:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617956140; cv=none; d=google.com; s=arc-20160816; b=vGzDEWXyJgwaXlroXv5s2gPEPKytyozLV7foMlwsgi2Wn+x10tlTDCysvBEon79SGU yayff2WuO25toK0KNyBIhKYVC0+e4euqQRiyrmsEMB3zYpgBzrwqEQwscc43rp7zxx7C GFpDLzu6Zj+rHqIaqZbtJ2f+P6wqdo3WQ1/m4azTayC5s12P2wFRzeSNs69FTZ6zpHIr WHadnExOD5iLhizP92yzditwylEtHFm6UPCmmdgPg0CPEF1jO1ctDAnlNn8k2dCwOI14 Xv6MDa+k/kn5ee/TWKSl9yxMFK3WuDUqvO3gENUPenrL4lXTFlpBU6NhqVsy80zyUaTe sW9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:dkim-signature; bh=6YraNPigCCa2QjWFUNdLS4ExsZNHhjTNhXM21Vxjs0s=; b=du3gyCb4vBtNPcEV4s64cBaEBMwv8vqlf1dfoWOeQeKUyWuRSOsQD022C2AA50WwQA sBFLVgqxEJK19EUVYOF9TAokpNgDCFDtkxEW+qeqyJBrAkvNrDCsg2HIBGRm8rts6pku /dRH+oHLm4r45WVa83CWALDnQRrjqy25OKDJrgylrsirbjPxvEEzjNjG4b/jI/hkriTC lHdcFcxM19RpcXRxQyQRssmr0H2Pdk4yuNSOGz3vBBOvyZk3He7aLH5V2o7oiTl2uoPo vqpBbpiFsP+BPVaMaNxfXpVNE2B1DuIwZhP88CHthWUI5I0jS4K1iIuWn59BrHabpsbT M9mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QohY6qYw; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 191si2777558pfu.249.2021.04.09.01.15.02; Fri, 09 Apr 2021 01:15:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QohY6qYw; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232327AbhDIIOu (ORCPT + 99 others); Fri, 9 Apr 2021 04:14:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55383 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232295AbhDIIOu (ORCPT ); Fri, 9 Apr 2021 04:14:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617956077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6YraNPigCCa2QjWFUNdLS4ExsZNHhjTNhXM21Vxjs0s=; b=QohY6qYwd0uA5XK6l966gmbPjTbovLlOjJUZwaAZLV8eVQGh7EBZqo54LtK8lD8q/KVpk7 9uWD9Y7VIAaMnupUDzgsWtLuJYCyQtDnK8XwRxqXjs6pK8cGi+3C0W4gRQEaQV7NP+JDh+ bF1GPcuj8J5AbeASqYEIlcD2C7aC/II= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-289-01GEC8DGP-Cp7uL9zOpe3g-1; Fri, 09 Apr 2021 04:14:33 -0400 X-MC-Unique: 01GEC8DGP-Cp7uL9zOpe3g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B9A5510054F6; Fri, 9 Apr 2021 08:14:31 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-119-35.rdu2.redhat.com [10.10.119.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id C66C160BE5; Fri, 9 Apr 2021 08:14:25 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: 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> To: Linus Torvalds Cc: dhowells@redhat.com, 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 Subject: Re: [RFC][PATCH] mm: Split page_has_private() in two to better handle PG_private_2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <184802.1617956064.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Fri, 09 Apr 2021 09:14:24 +0100 Message-ID: <184803.1617956064@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Linus Torvalds wrote: > > #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? Sure. Do we even want it still, or should I just fold it into page_needs_cleanup()? It seems to be the only place it's used. > > +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 eve= n just > > return PagePrivate(page); Sorry, yes, it should be that. I was looking at transforming the "1 << PG_private" and completely overlooked that this should be PagePrivate(). > 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). Yeah. I seem to recall that test_bit() on some arches used to return the datum just with the other bits masked off, but I may be misremembering. In asm-generic/bitops/non-atomic.h: static inline int test_bit(int nr, const volatile unsigned long *addr) { return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1))); } should perhaps return bool? I wonder, should: static __always_inline int PageTail(struct page *page) static __always_inline int PageCompound(struct page *page) static __always_inline int Page##uname(struct page *page) static __always_inline int TestSetPage##uname(struct page *page) static __always_inline int TestClearPage##uname(struct page *page) also all return bool? David