Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2274515ybg; Thu, 24 Oct 2019 07:25:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBOtsbsgbx/OzutW47gTtJXcit2l6P+3a0FyOPmgr0E2HmqbsP5lZ0oD6suK5eyd2rylQ/ X-Received: by 2002:a17:906:b347:: with SMTP id cd7mr3336671ejb.105.1571927137591; Thu, 24 Oct 2019 07:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571927137; cv=none; d=google.com; s=arc-20160816; b=XlO4UqLJHFApLBWBQ/8Y1j1WOtaE0dCig1vA17AV5gjPBgm3iOusBhKNib8IQgQK5M QkKAGjyZCU3WUqX6kFhGs5SyE+dTBTwSKuC8vbYPVzc77iM0oI8/IC1Bmck26n6FLHTM 9ZIK7BFzwNPXAf3Uida3/CbGdF6D2NqE1hsg5pEImrG33gnVxecaZDrWBViz/bAeqPW2 1EEtvB8fSdDbWG9PSDrO/Bqp/QEGakh8QXCT9dz18pAObFN5eV82pbl+1N4GLm+CC5O/ 5zdEGODLSTWgkebW2IMUb9Lj34CJs06nFhW0BLGEtp1a3eaXxRG7aSrhWm8yAsaXTQCg HaHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=fIntE3OTxm9guIcHMnakqjVLfmLbLjeezPmfLNwkUu8=; b=ecprrazfKaNKood1tCXFiZDOXEY80nGppwct6F9Zcacfm5BPvFlb+fDNdjeQVyKTRQ SMDBZACIu1/NTqRF+yuZHvSygmJI2la/XFFGB0vK01bm/KmKssdSKJhjwVrcPiiVcxuh sEne2LKpNnvDHmYFooFYcbTzkE6t3JmH+tNH+yGg0CVUhAsRdA6WsjukGPf9HfYe6f8w 5UQ0EaH+CYeSz01DAOQLPIxPa7XDYgVkNkTsQt5zRuh1AtOE2jQTHvJosdqWNwWLKndU 4MGpxkidBDxv3Y2jujriiYT1qC7i+zwXLnuh1Rgnap85B5+LIgeysh3rAW69FosvHiEd kLfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i19si15098518ejf.247.2019.10.24.07.25.12; Thu, 24 Oct 2019 07:25:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391784AbfJWUuX (ORCPT + 99 others); Wed, 23 Oct 2019 16:50:23 -0400 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:40569 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390611AbfJWUuW (ORCPT ); Wed, 23 Oct 2019 16:50:22 -0400 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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