Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp606006pxj; Thu, 3 Jun 2021 14:52:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJ1vMV+h461eh6Ujn4v9tIEg9P6kiaY85gWSyRQlKxF9v7U7uZHhHlqe36l5VpyqwtYjat X-Received: by 2002:aa7:d413:: with SMTP id z19mr1435860edq.37.1622757147836; Thu, 03 Jun 2021 14:52:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622757147; cv=none; d=google.com; s=arc-20160816; b=p+ZJgZ86/TQxdqZpK9V/WKeHL8g5HEX9OLyRBdZfX9RmyVrsmRl/7OTaVSbObNLPPR YLLZoiDQeZL+Er/NsFctTtpgL3b95HFliiT6XSGNRyvZ1in0B8zMnofjBIiCUAmOO6Xw fQc+Sy960fWtxw+1OpY8DLOSCGYTpi6I3tBapyXV0+Lgz7vc50fm0ZeW3CXszTh5rpXh rA4SI3mOokN+j7wignkemwfx1C9R5M3s28CIOoqaamxOZzx2cMRJhpR7GStSKknmJ3Ph atUA3mDbLuVVP3JjD7g0clh/GK9JKkB/mEbFsZu+X2IlCEo2JItCtPRruJrPjb6U2/Eh dfog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UyrGmdBsIRNJXWAqlX5+7cTy9HYr4MDviQbOZ7GPJ4c=; b=OQf+bcwi5ubOrD4fnwRdGxPphRANvndfrlY7VhyF2uMiHa29Fm11J79wUVC3rLoCFi 0N2wULa4CgrcGTxMG/oT5bMueajB/G1LyFwwfPxd8olKdXfGh+ARfD8xm17QV1wc69/2 qQtJ+XfnG5mdn7xg57GfojtH2weUCEbEbqBlsquEpvvdksyEZhkz5guKpFSEDy/dniik RkTkTQhSexZhckDqoVA539nSy9nArVyI5mcH2/mliPfLIFm5TTFZh5NmSOW8EfJue8B3 zba/SlDN2SVf9LLQSu95p3suAOAukCk8G8db7H2tDfsPeNVDCGkg2TRhfgBBuucXk39t fIGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ElUYo3/h"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f6si2986882ejl.241.2021.06.03.14.52.04; Thu, 03 Jun 2021 14:52:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ElUYo3/h"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230344AbhFCVug (ORCPT + 99 others); Thu, 3 Jun 2021 17:50:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45805 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230341AbhFCVuf (ORCPT ); Thu, 3 Jun 2021 17:50:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622756930; 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=UyrGmdBsIRNJXWAqlX5+7cTy9HYr4MDviQbOZ7GPJ4c=; b=ElUYo3/h2KCc3gKIB2wzAnVwmHGmyQ9UI5G43llw9Q+XDM+AGQacUXaLwMcliVUHyGMXSZ UoRHUPULdp1FF/vGifw7PzYQVWZMCellaRPSzZDA4CYQowlTHTEhWBZnwEPCvc8g1NsUCj REJteAR7+KjG1EGzHmNmBmLPJ8RSlmQ= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-581--rKPlF7_PnSxD1mL2aW-Gg-1; Thu, 03 Jun 2021 17:48:49 -0400 X-MC-Unique: -rKPlF7_PnSxD1mL2aW-Gg-1 Received: by mail-qv1-f71.google.com with SMTP id if5-20020a0562141c45b029021fee105740so1390033qvb.9 for ; Thu, 03 Jun 2021 14:48:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UyrGmdBsIRNJXWAqlX5+7cTy9HYr4MDviQbOZ7GPJ4c=; b=bArz5PieW4DfF8AhU6JquBNKEue4PlQvKfKisJz6PVLW+QKZtfljiMfy7l4hrSn65Y Zvp55pwoNsyptpvEXpPeTAsqpfx+xTPALjk5Txy/ENEYX/t5MabIp/anUflGwAPi4Eua lbZB0VRqXxG1vt9JpFRnwNG/4oJAWuUXbAMuXZwa9cXUnpFmPnM1jadTWbLvBcAkzpBT vCaVr8uiYUsapu4Hv9PVFmceUrM5pjqkGvPTgDIHqvUBYMQLiUMscjG3d+4GhUB5w8ZV M1AD69fAiqEo/D3C93MIMpZOsOvnTF3cUKwfHEY/eRkwq28WeZVZP74pb5THS9z2wzpw xbHA== X-Gm-Message-State: AOAM531+lx7bcF5wt87YdZky/a41eZ2qnw+tRhuM+Js9gtexXN8nzYIV IGxkSzn8TNpq0gTRFk1VxBl3FCkDEXuWfsiEsp9JvQVnpAnhNzHwME9gK+YrS8LLVVdL9g+HL/F zJnRR8XfCxv77rnRssGxYOYfE X-Received: by 2002:ad4:53ab:: with SMTP id j11mr1734619qvv.38.1622756928994; Thu, 03 Jun 2021 14:48:48 -0700 (PDT) X-Received: by 2002:ad4:53ab:: with SMTP id j11mr1734600qvv.38.1622756928721; Thu, 03 Jun 2021 14:48:48 -0700 (PDT) Received: from t490s (bras-base-toroon474qw-grc-61-184-147-118-108.dsl.bell.ca. [184.147.118.108]) by smtp.gmail.com with ESMTPSA id s5sm2378221qtn.33.2021.06.03.14.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 14:48:48 -0700 (PDT) Date: Thu, 3 Jun 2021 17:48:46 -0400 From: Peter Xu To: Hugh Dickins Cc: Andrew Morton , "Kirill A. Shutemov" , Yang Shi , Wang Yugui , Matthew Wilcox , Naoya Horiguchi , Alistair Popple , Ralph Campbell , Zi Yan , Miaohe Lin , Minchan Kim , Jue Wang , Jan Kara , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/7] mm/thp: try_to_unmap() use TTU_SYNC for safe DEBUG_VM splitting Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 01, 2021 at 02:07:53PM -0700, Hugh Dickins wrote: > diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c > index 2cf01d933f13..b45d22738b45 100644 > --- a/mm/page_vma_mapped.c > +++ b/mm/page_vma_mapped.c > @@ -212,6 +212,14 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) > pvmw->ptl = NULL; > } > } else if (!pmd_present(pmde)) { > + /* > + * If PVMW_SYNC, take and drop THP pmd lock so that we > + * cannot return prematurely, while zap_huge_pmd() has > + * cleared *pmd but not decremented compound_mapcount(). > + */ > + if ((pvmw->flags & PVMW_SYNC) && > + PageTransCompound(pvmw->page)) > + spin_unlock(pmd_lock(mm, pvmw->pmd)); > return false; > } > if (!map_pte(pvmw)) Sorry if I missed something important, but I'm totally confused on how this unlock is pairing with another lock().. And.. isn't PVMW_SYNC only meaningful for pte-level only (as I didn't see a reference of it outside map_pte)? -- Peter Xu