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=-17.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 B2163C432BE for ; Wed, 18 Aug 2021 19:15:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3A30D61101 for ; Wed, 18 Aug 2021 19:15:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3A30D61101 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 4F0FE6B006C; Wed, 18 Aug 2021 15:15:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 479EA6B0071; Wed, 18 Aug 2021 15:15:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 31AA48D0001; Wed, 18 Aug 2021 15:15:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0128.hostedemail.com [216.40.44.128]) by kanga.kvack.org (Postfix) with ESMTP id 132FB6B006C for ; Wed, 18 Aug 2021 15:15:00 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 9D17A180A3231 for ; Wed, 18 Aug 2021 19:14:59 +0000 (UTC) X-FDA: 78489153918.18.F42298F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 3CCDAD00C771 for ; Wed, 18 Aug 2021 19:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629314098; 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=ptS7X8PW56n92I0moLrJCHuXcvagFzrTyl9zSuu1TCk=; b=dm23voAkV8dX0je2+gPyEDvwNSDzWXWGC/AoRRJw19w9KYmiX5uDq8yIazRHlwv/8Djd3S cfaZtfzlWO5P+qOB192SsfHtVM0x9MjuPwRRfpB8NEbi6UiymLGExHAyLCerqGgRED6PL8 PeIzPTvf6Pf6/MNaY85ctliYlsnfZKs= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-538-WJzLsl9YNSmXllsiLedXrQ-1; Wed, 18 Aug 2021 15:14:56 -0400 X-MC-Unique: WJzLsl9YNSmXllsiLedXrQ-1 Received: by mail-wm1-f69.google.com with SMTP id c2-20020a7bc8420000b0290238db573ab7so2577558wml.5 for ; Wed, 18 Aug 2021 12:14:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:organization:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=ptS7X8PW56n92I0moLrJCHuXcvagFzrTyl9zSuu1TCk=; b=N+fxAe8NIrIC3CgRc8fEb8XFiXn6jrPXy8FGahii/pwamZ7fq/I+A3r6giWbGaaWaS +qdZuFNwO0zz1xIx4yVZnNCerkHcLtVNLGxRRZbQC4daV2nDrRMDAg2OrQHeqpZ9O/Jw RY/3eakkT2nunYMAwVQx0x6J6XZRUl8jEQ7wia7aT7TG4kgDF3oZ2dO2LvGExoXshptO 5gZAT0mNl078kuJPoRoNQP/VBr+Sg6Ha68c6/nMwBdfYC+knidBhOaprllyDFAe6rH5+ aHIJ5J5zzGHlPI6B1jMTci5HdZ4HBeEl1XZXObxf3lFzg1STHLL+W2xorubWcbJImzFF b5nQ== X-Gm-Message-State: AOAM533w0HNgfTMZAvEHK2EmjneVMiyC3RKU4wQYqnlZsMB4tUYOf92A 7CZQAqBGcIKgLrxu6n66Lzc9+FJ+3AeEawszUDb7pPR8dpS6iW7CPogBp23KG7rtrepIjnHIDSr hEBWho7tPnl8= X-Received: by 2002:adf:f943:: with SMTP id q3mr12696968wrr.118.1629314095583; Wed, 18 Aug 2021 12:14:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqZI9YqEOvyyt2wdU8FIMQJkxlVy7xxYmXG7X44VjkH6MpzwgAB+l9FC/cxG0T3YuU5RyPIA== X-Received: by 2002:adf:f943:: with SMTP id q3mr12696934wrr.118.1629314095308; Wed, 18 Aug 2021 12:14:55 -0700 (PDT) Received: from [192.168.3.132] (p5b0c6417.dip0.t-ipconnect.de. [91.12.100.23]) by smtp.gmail.com with ESMTPSA id s141sm517033wme.6.2021.08.18.12.14.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Aug 2021 12:14:54 -0700 (PDT) To: Tiberiu A Georgescu , corbet@lwn.net, linux-doc@vger.kernel.org, linux-mm@kvack.org Cc: peter.xu@redhat.com, ivan.teterevkov@nutanix.com, florian.schmidt@nutanix.com, carl.waldspurger@nutanix.com, jonathan.davies@nutanix.com References: <20210812155843.236919-1-tiberiu.georgescu@nutanix.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH] Documentation: update pagemap with SOFT_DIRTY & UFFD_WP shmem issue Message-ID: <8f7d6856-7bcd-dedf-663b-cd7ef2d0827f@redhat.com> Date: Wed, 18 Aug 2021 21:14:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210812155843.236919-1-tiberiu.georgescu@nutanix.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dm23voAk; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf21.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-Stat-Signature: u1yhpkrxjfpn99tsnruiitrir6yt8uk6 X-Rspamd-Queue-Id: 3CCDAD00C771 X-Rspamd-Server: rspam05 X-HE-Tag: 1629314099-998677 Content-Transfer-Encoding: quoted-printable 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 12.08.21 17:58, Tiberiu A Georgescu wrote: > Mentioning the current missing functionality of the pagemap, in case > someone stumbles upon unexpected behaviour. >=20 > Signed-off-by: Tiberiu A Georgescu > Reviewed-by: Ivan Teterevkov > Reviewed-by: Florian Schmidt > Reviewed-by: Carl Waldspurger > Reviewed-by: Jonathan Davies > --- > Documentation/admin-guide/mm/pagemap.rst | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/Documentation/admin-guide/mm/pagemap.rst b/Documentation/a= dmin-guide/mm/pagemap.rst > index fb578fbbb76c..627f3832b3a2 100644 > --- a/Documentation/admin-guide/mm/pagemap.rst > +++ b/Documentation/admin-guide/mm/pagemap.rst > @@ -207,3 +207,9 @@ Before Linux 3.11 pagemap bits 55-60 were used for = "page-shift" (which is > always 12 at most architectures). Since Linux 3.11 their meaning chan= ges > after first clear of soft-dirty bits. Since Linux 4.2 they are used f= or > flags unconditionally. > + > +Note that the page table entries for swappable and non-syncable pages = are > +cleared when those pages are zapped or swapped out. This makes informa= tion > +about the page disappear from the pagemap. The location of the swappe= d > +page can still be retrieved from the page cache, but flags like SOFT_D= IRTY > +and UFFD_WP are lost irretrievably. >=20 UFFD_WP is currently only supported for private anonymous memory, where=20 it should just work (a swap entry with a uffd-wp marker). So can we even=20 end up with UFFD_WP bits on shmem and such? (Peter is up-streaming that=20 right now, but there, I think he's intending to handle it properly=20 without these bits getting lost using pte_markers and such). So regarding upstream Linux, your note regarding UFFD_WP should not be=20 applicable, right? On a related note: if we start thinking about the pagemap expressing=20 which pages are currently mapped into the page tables ("state of the=20 process page tables") mostly all starts making sense. We document this=20 as "to examine the page tables" already. We only get swapped information if there is a swap PTE -- which only=20 makes sense for anonymous pages, because there, the page table holds the=20 state ("single source of truth"). For shmem, we don't have it, because=20 the page cache is the single source of truth. We only get presence information if there is a page mapped into the page=20 tables -- which, for anonymous pages, specifies if there is anything=20 present at all. For shmem we only have it if it's currently mapped into=20 the page table. Losing softdirt is a bad side effect of, what you describe, just setting=20 a PTE to none and not syncing back that state back to some central place=20 where it could be observed even without the PTE at hand. Maybe we should document more clearly, especially what to expect for=20 anonymous pages and what to expect for shared memory etc from the=20 pagemap. Once we figured out which other interfaces we have to deal with=20 shared memory (minore(), lseek() as we learned), we might want to=20 document that as well, to safe people some time when exploring this area. --=20 Thanks, David / dhildenb