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=-7.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 E9207C433F5 for ; Wed, 22 Sep 2021 19:33:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 871DE610A1 for ; Wed, 22 Sep 2021 19:33:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 871DE610A1 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 E3DBD94000B; Wed, 22 Sep 2021 15:33:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DEDA094000A; Wed, 22 Sep 2021 15:33:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CDC2694000B; Wed, 22 Sep 2021 15:33:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0179.hostedemail.com [216.40.44.179]) by kanga.kvack.org (Postfix) with ESMTP id C204094000A for ; Wed, 22 Sep 2021 15:33:38 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 5D5991804307C for ; Wed, 22 Sep 2021 19:33:38 +0000 (UTC) X-FDA: 78616208916.11.8B9D497 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf09.hostedemail.com (Postfix) with ESMTP id 1112C3000108 for ; Wed, 22 Sep 2021 19:33:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632339217; 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: in-reply-to:in-reply-to:references:references; bh=f2f6GY/k+WHkP8PIaS49hP7if2E/jVetS1Wkw8ZmRZ4=; b=CF9nosk3yHVYSVlrJzT+I+qHXoVnx1XRYWZNkAGXjaDjPXkrw5RykwKnO3zILyMQX6b62D htwCB16VElIsOS8nM0APGFxsLZvmlg41b1qserW3L7Qrd4IPc7TrcQ9JnNuG17OUPhTlSd W6PJN14gnOR/0ZvbbXnb3gc6pMK2ty4= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-487-posb_ww6O5qNvPGUuzT0JQ-1; Wed, 22 Sep 2021 15:33:35 -0400 X-MC-Unique: posb_ww6O5qNvPGUuzT0JQ-1 Received: by mail-qt1-f199.google.com with SMTP id w10-20020ac87e8a000000b002a68361412bso11050091qtj.7 for ; Wed, 22 Sep 2021 12:33:35 -0700 (PDT) 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:message-id:references :mime-version:content-disposition:in-reply-to; bh=f2f6GY/k+WHkP8PIaS49hP7if2E/jVetS1Wkw8ZmRZ4=; b=uJ7HVi4i0J7rzuZ+vPRXeZ3fJFG1lRquEnvamPY02D31BcH7c6jrm8dDLV5TajvMeW ZY+deuOA3b647O//uwtRMEVhhXFWarNAbHg/RWLNtCudBYw/37YUO49HCaXKvD0FImgU 50WfSQjIu8ROPOl7BsPzXqbYy3NmLcxE06ox5DOt9gH2KSGhry95nueVU4DvOAlofIXN wPVn3SFVZyN9wXEnQuED6TpTCnmJw+rPqDeq53MbCmvz2q0NYKFhUBYe9/P5KgI4WVbY 17/9uVYqRT9uNNfjUtftKB/P36C+zgCvHWhJFnG462Kx602fkxDAaSue1w8ghFI6z6y5 20Aw== X-Gm-Message-State: AOAM531wZxSc9t+3nUtinYqz0QEfhCORou+24vC5Mi2NdWtTHPKbLoZ+ zfXOvxmsITSq0FDE3yrH5t1HeGK+LLh7MMxHJpRqeOrvHFvxDXrA2IRvyb3dKMnUrMsC1+z0fGN mPIAGrxzoJwA= X-Received: by 2002:ad4:496d:: with SMTP id p13mr545379qvy.52.1632339213521; Wed, 22 Sep 2021 12:33:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEskVJDI8LuI1oLFi2/J9rYgsc5EpRwJ36kYV2MjmbtvADCj+y/xroIs/VbeLdU5PgFkJOvA== X-Received: by 2002:ad4:496d:: with SMTP id p13mr545202qvy.52.1632339211549; Wed, 22 Sep 2021 12:33:31 -0700 (PDT) Received: from t490s ([2607:fea8:56a2:9100::d3ec]) by smtp.gmail.com with ESMTPSA id l1sm2030263qti.94.2021.09.22.12.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Sep 2021 12:33:30 -0700 (PDT) Date: Wed, 22 Sep 2021 15:33:29 -0400 From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Andrew Morton , Andrea Arcangeli , Axel Rasmussen , Hugh Dickins , Nadav Amit Subject: Re: [PATCH] mm/khugepaged: Detecting uffd-wp vma more efficiently Message-ID: References: <20210922175156.130228-1-peterx@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210922175156.130228-1-peterx@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 1112C3000108 X-Stat-Signature: awse1ntmoxsc5rmucaezyett3ho5bwhw Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CF9nosk3; spf=none (imf09.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1632339217-920452 X-Bogosity: Ham, tests=bogofilter, spamicity=0.027666, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Sep 22, 2021 at 01:51:56PM -0400, Peter Xu wrote: > Axel: as I asked in the other thread, please help check whether minor mode will > work properly with shmem thp enabled. If not, I feel like this patch could be > part of that effort at last, but it's also possible that I missed something. Hmm, this seems to be a false-alarm too. UFFDIO_CONTINUE is fine with thp because shmem_getpage() only returns small pages. Khugepaged is fine too on merging small shmem pages into thps, the same reason as uffd-wp: it zaps ptes only, so previous pte_none() ptes will keep the same, it makes sure all old pte_none ptes will not continue until a UFFDIO_CONTINUE. The only last problem is when khugepaged merged small ptes into a thp, then it could zap ptes even if they existed before. So for minor mode fault, the uffd service thread needs to be prepared for false positive messages. That shouldn't be a problem either, because file-backed memory pgtables are unstable and prone to lost, so uffd minor fault handler should always be prepared for false positives anyway.. In summary: please feel free to ignore the above note, and sorry for the noise. -- Peter Xu