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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 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 5A370C47E49 for ; Wed, 23 Oct 2019 20:50:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1BE6F20650 for ; Wed, 23 Oct 2019 20:50:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1BE6F20650 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BCFF86B0003; Wed, 23 Oct 2019 16:50:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B7FF46B0006; Wed, 23 Oct 2019 16:50:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A95576B0007; Wed, 23 Oct 2019 16:50:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0142.hostedemail.com [216.40.44.142]) by kanga.kvack.org (Postfix) with ESMTP id 819EA6B0003 for ; Wed, 23 Oct 2019 16:50:24 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id EC5028249980 for ; Wed, 23 Oct 2019 20:50:23 +0000 (UTC) X-FDA: 76076242326.28.match28_77be0d88d932a X-HE-Tag: match28_77be0d88d932a X-Filterd-Recvd-Size: 2707 Received: from out30-57.freemail.mail.aliyun.com (out30-57.freemail.mail.aliyun.com [115.124.30.57]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Wed, 23 Oct 2019 20:50:22 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07486;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0Tg.Zevt_1571863816; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0Tg.Zevt_1571863816) by smtp.aliyun-inc.com(127.0.0.1); Thu, 24 Oct 2019 04:50:19 +0800 Subject: Re: [v2 PATCH] mm: thp: handle page cache THP correctly in PageTransCompoundMap To: Hugh Dickins Cc: aarcange@redhat.com, kirill.shutemov@linux.intel.com, gavin.dg@linux.alibaba.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <1571850304-82802-1-git-send-email-yang.shi@linux.alibaba.com> <4d3c14ef-ee86-2719-70d6-68f1a8b42c28@linux.alibaba.com> From: Yang Shi Message-ID: Date: Wed, 23 Oct 2019 13:50:14 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US 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 10/23/19 1:00 PM, Hugh Dickins wrote: > On Wed, 23 Oct 2019, Yang Shi wrote: >> On 10/23/19 12:28 PM, Hugh Dickins wrote: >>>> + return map_count >= 0 && >>> You have added a map_count >= 0 test there. Okay, not wrong, but not >>> necessary, and not consistent with what's returned in the PageAnon >>> case (if this were called for an unmapped page). >> I was thinking about this too. I'm wondering there might be a case that the >> PMD is split and it was the last PMD map, in this case subpage's _mapcount is >> also equal to compound_mapcount (both is -1). So, it would return true, then >> KVM may setup PMD map in EPT, but it might be PTE mapped later on the host. >> But, I'm not quite sure if this is really possible or if this is really a >> integrity problem. So, I thought it might be safer to add this check. > The mmu_notifier_invalidate_range_start.._end() in __split_huge_pmd(), > with KVM's locking and sequence counting, is required to protect > against such races. OK, it sounds safe. Thanks for confirming. Will post v4 soon. > > Hugh