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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B5AFC433EF for ; Sat, 12 Mar 2022 08:11:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C18B68D0002; Sat, 12 Mar 2022 03:11:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BC77B8D0001; Sat, 12 Mar 2022 03:11:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A674A8D0002; Sat, 12 Mar 2022 03:11:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 970E68D0001 for ; Sat, 12 Mar 2022 03:11:21 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6B21220630 for ; Sat, 12 Mar 2022 08:11:21 +0000 (UTC) X-FDA: 79235014362.07.499775E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id C76F640020 for ; Sat, 12 Mar 2022 08:11:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647072680; 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=OFLnAdgDOQ5hQlNRliUXXsmFU+Cm7xTjHzqvxYTuqXE=; b=A8B0eXS7ieULiDIG7UVy8D9Yb7Ztv0ODeqi/4Fh3JoL+Xida5v7T/1N7jYkzrprpMf2PBs qHvZBhjeRVIgkoVbCqoBvlYT1TYyzRadfjgD0BuRvJwylDMs8KpuxUFLP7o0HrrkggS4pr xLPMfNyrDl0jT14lHpkCdVf/LC+6V2g= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-610-CG27etFMPGe-fITJDJNkqg-1; Sat, 12 Mar 2022 03:11:19 -0500 X-MC-Unique: CG27etFMPGe-fITJDJNkqg-1 Received: by mail-wm1-f72.google.com with SMTP id h206-20020a1c21d7000000b003552c13626cso6558877wmh.3 for ; Sat, 12 Mar 2022 00:11:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=OFLnAdgDOQ5hQlNRliUXXsmFU+Cm7xTjHzqvxYTuqXE=; b=rAiZl5aRkPO1quHpQULZzapj2bH5e+0MAg8Gbfos83du6LstPUxn1xwLoklzH2XC2Y HST6+umPtSVy22JcoXYJJgfCQ5+pvO7Kcm81UflMfz8JvE/bDnfN52QuEH7n6FSNS/Eh R71nu8ewqMi1PtY2RR4Mo4RMjsW3Wt5wuWFzjwtCsvjzBvlztALxrD/uJVDU7lHYz4k5 VGKJbU3KerMageDi4Qw/I53ZjF/v7lEdi//vdk0iw8JteyNIHUpsQ3r8SxqDq74V1eEx eSO33sIvt5NQGlCi9qrf2E/iBjAhLfZfuqHKJnab3SqaIUqAqvJXKsexPaxCwb/6KTKA EoeA== X-Gm-Message-State: AOAM531Ms7xcWK38+jPOwB+bm1QRZbRQqtP8NFOMvDs98rHqha54luJ2 DNb4RX6A64oprTcwfvNo/oEcPh9RSHttvO0d1UYrydSD31gZYVDfNVO9IWo/Uq4CfnCm+zYMOlG VDnsv+KGKm7Q= X-Received: by 2002:a05:600c:35d4:b0:389:cdff:7f47 with SMTP id r20-20020a05600c35d400b00389cdff7f47mr10073095wmq.127.1647072677812; Sat, 12 Mar 2022 00:11:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQpvEXNxt9hA7e0QKh4J0CgDiDeYaJnud26vT5cgg1hnewDfl+WaiLYT8dPf+LJSQaCG/esw== X-Received: by 2002:a05:600c:35d4:b0:389:cdff:7f47 with SMTP id r20-20020a05600c35d400b00389cdff7f47mr10073055wmq.127.1647072677552; Sat, 12 Mar 2022 00:11:17 -0800 (PST) Received: from ?IPV6:2003:cb:c71e:1600:ad89:c64e:8371:c9c4? (p200300cbc71e1600ad89c64e8371c9c4.dip0.t-ipconnect.de. [2003:cb:c71e:1600:ad89:c64e:8371:c9c4]) by smtp.gmail.com with ESMTPSA id v12-20020a5d4a4c000000b001e68ba61747sm8257257wrs.16.2022.03.12.00.11.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 12 Mar 2022 00:11:17 -0800 (PST) Message-ID: <6e0c4a21-7dff-044b-cd4b-6d612559f10d@redhat.com> Date: Sat, 12 Mar 2022 09:11:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH v1 10/15] mm/page-flags: reuse PG_slab as PG_anon_exclusive for PageAnon() pages To: Matthew Wilcox Cc: Linus Torvalds , Linux Kernel Mailing List , Andrew Morton , Hugh Dickins , David Rientjes , Shakeel Butt , John Hubbard , Jason Gunthorpe , Mike Kravetz , Mike Rapoport , Yang Shi , "Kirill A . Shutemov" , Vlastimil Babka , Jann Horn , Michal Hocko , Nadav Amit , Rik van Riel , Roman Gushchin , Andrea Arcangeli , Peter Xu , Donald Dutile , Christoph Hellwig , Oleg Nesterov , Jan Kara , Liang Zhang , Pedro Gomes , Oded Gabbay , Linux-MM References: <20220308141437.144919-1-david@redhat.com> <20220308141437.144919-11-david@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C76F640020 X-Stat-Signature: oky7owjo7at3t3qk8ogh1wououdikmmn Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=A8B0eXS7; spf=none (imf12.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1647072680-66722 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 11.03.22 22:11, Matthew Wilcox wrote: > On Fri, Mar 11, 2022 at 08:36:37PM +0100, David Hildenbrand wrote: >> I used PG_error before, but felt like using a bit that is never ever >> valid to be set/cleared/checked on a subpage would be even a better fit: >> >> Note the: >> >> PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) __CLEARPAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) >> >> whereby PF_ONLY_HEAD translates to: >> >> "for compound page, callers only ever operate on the head page." >> >> >> I can just switch to PG_error, but for the second subpage, PG_waiters >> should be just fine (unless I am missing something important). > > I think you're missing something important that almost everybody misses > when looking at this code (including me). > > PF_ANY flags can be set on individual pages. > PF_HEAD means "we automatically redirect all operations to the head page". > PF_ONLY_HEAD means "If you try to call this on a tail page, we BUG". > PF_NO_TAIL means "If you try to read this flag on a tail page, we'll > look at the head page instead, but if you try to set/clear this flag > on a tail page, we BUG" ^ that's actually the confusing part for me "modifications of the page flag must be done on small or head pages, checks can be done on tail pages too." Just from reading that I thought checks on the tail page would *not* get redirected to the head. I'd have written that as and extended version of PF_HEAD: "for compound page all operations related to the page flag are applied to head page. Checks done on a tail page will be redirected to the head page." [...] > > So really, you can reuse any flag as PF_SECOND that isn't PF_ANY. > I'll go back to PG_error, thanks! -- Thanks, David / dhildenb