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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 B5D88C433F5 for ; Wed, 22 Sep 2021 23:18:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 50D4161153 for ; Wed, 22 Sep 2021 23:18:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 50D4161153 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 650A7940008; Wed, 22 Sep 2021 19:18:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5FE47940007; Wed, 22 Sep 2021 19:18:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4EC59940008; Wed, 22 Sep 2021 19:18:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0094.hostedemail.com [216.40.44.94]) by kanga.kvack.org (Postfix) with ESMTP id 41136940007 for ; Wed, 22 Sep 2021 19:18:27 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id F404A31EC2 for ; Wed, 22 Sep 2021 23:18:26 +0000 (UTC) X-FDA: 78616775454.36.753D581 Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by imf14.hostedemail.com (Postfix) with ESMTP id AC02D6001981 for ; Wed, 22 Sep 2021 23:18:26 +0000 (UTC) Received: by mail-qt1-f170.google.com with SMTP id d8so4472651qtd.5 for ; Wed, 22 Sep 2021 16:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=AMmc2S9EwrQHTB819xMq3/OnJbyotUeYMqzS5bfmA5w=; b=RyJALmgNRSWoqvMs9gV5fDXpRptPIFyZbRI3cNPRX5QO4NQhyHjrnsUVYHO73CFMsH ZSi5qRIoAJHxg+56mwwThpwRuzgo8IFptaJ212yqWkJyM6Sx4KihlyB+O7tFJbGsiwc1 5ItAnp1rHaG6p/tBAfqdIfEvqcFekqeaPPbGz0FwgF+6tw5LB0NiOMPEe+cgbz0TLvRC PzgLkZtXmR5KxfV/fObEyCOhjOGXBPi8du4i+4Ebj4xy1+2/050llqA6lJ9VhAytn1nk OM8G+/MwCAm6QuTKNxfKBsxLzRFpAZBUr+050Vn9nCUIyrd0j8N5pFsaDR74mMTtXTQE E0mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=AMmc2S9EwrQHTB819xMq3/OnJbyotUeYMqzS5bfmA5w=; b=gpN2jDJ9D++xwa0cWXVVROEVwFziWVxuFYwijgqQhe8wIu0tGp5Vwo6lGVXN8p127v zh9wxx8DjWK1NJtRBtZc8Yb+Jyp0hS2Abe+qdQ+ykarq4UF9IwK0ZfluH08VJNBi2nYX Qj7KnhSNbj3FJ1R7kJWtfRCmC25N1qElyd7iUjzB2D0Ni3PFK/hejSpUujxNKFYbuuvj 65A1H5cEBpUJTciFd6YYe+63HuiIOdkx2cLJxUpJYhM+2CfFfRdpzB2gKAoCnhvta8x3 O7ZuP3xpygJHivT1pBMoTqtryYJCzsS713cKl2mGf7vfhIPZ493z6KcGOItCX1KOpoeV 8pwA== X-Gm-Message-State: AOAM530x6/TilW8UU0OASuNgkFJGmAAzZu+fsTs0e1Um/Qt7BgFMfCgL diJVa22o2i6oArPfOl/McU94Pg== X-Google-Smtp-Source: ABdhPJzMrxos1y2f6+UtwI3iVasX7ubloEvN0kUUt5KvFEvCfhuOzzR6wW2XkMfQ+ariaREXFhtZlw== X-Received: by 2002:ac8:720f:: with SMTP id a15mr2011057qtp.84.1632352705855; Wed, 22 Sep 2021 16:18:25 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id y23sm2969068qkj.128.2021.09.22.16.18.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Sep 2021 16:18:24 -0700 (PDT) Date: Wed, 22 Sep 2021 16:18:09 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Peter Xu cc: Axel Rasmussen , LKML , Linux MM , Andrew Morton , Andrea Arcangeli , Hugh Dickins , Nadav Amit Subject: Re: [PATCH] mm/khugepaged: Detecting uffd-wp vma more efficiently In-Reply-To: Message-ID: <24224366-293a-879-95db-f69abcb0cb70@google.com> References: <20210922175156.130228-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Stat-Signature: 7t49nytuct5mqo55yrmmtt5cf7seqkuc Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=RyJALmgN; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf14.hostedemail.com: domain of hughd@google.com designates 209.85.160.170 as permitted sender) smtp.mailfrom=hughd@google.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: AC02D6001981 X-HE-Tag: 1632352706-240834 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 Wed, 22 Sep 2021, Peter Xu wrote: > > Not installing pmd means uffd-minor can still trap any further faults just like > before, afaiu. > > There's a very trivial detail that the pmd missing case will have a very slight > code path change when the next page fault happens: in __handle_mm_fault() we'll > first try to go into create_huge_pmd() once, however since shmem didn't provide > huge_fault(), we'll go the VM_FAULT_FALLBACK path, and things will go like > before when faulting on a small pte. The next UFFDIO_CONTINUE will allocate > that missing pmd again, however it'll install a 4K page only. I think you're mistaken there. I can't tell you much about ->huge_fault(), something introduced for DAX I believe; but shmem has managed pmd mappings without it, since before ->huge_fault() was ever added. Look for the call to do_set_pmd() in finish_fault(): I think you'll find that is the way shmem's huge pmds get in. Earlier in the thread you suggested "shmem_getpage() only returns small pages": but it can very well return PageTransCompound pages, head or tail, which arrive at this do_set_pmd(). Hugh