Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1217726pxj; Fri, 4 Jun 2021 08:50:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2NmXyUvOzZseStaRCPXTEFutLMHOFDxCcloXmV0BgFE0AdsS8dO1W6WxqCkGAvX/L+SoU X-Received: by 2002:a17:906:1815:: with SMTP id v21mr4833978eje.376.1622821839314; Fri, 04 Jun 2021 08:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622821839; cv=none; d=google.com; s=arc-20160816; b=Gzhy578iC31f4aUQDL274gg6qEuIiO4ix2inmBjKz6w+SPRUAgVRb8XyY91Cv1CQLC 1QRkJB8FdAQKTfK06HHsI6xvhjXbrbO1x/BScAatyx+OiwexfE2/IrbQRHTZ8EL4yu3r w3D5VT6OP07Ux0/5R2jji37lcITUN0QMFJ59DopaqvynBvHO6c4qMD6c0hrbnd6kSjga 5obZxzB3R722htFD/3rLD/GHzD6/b4MZeXMdCZ+p9N1tr9modtbnaUCqTnrKHgg2IeU7 zzENekYcQo5+8/Gp1NqyR8SmKfwh0Y+TnYo2rjWtK86f/1SXz6+NXw+HYVzwewWa/wA3 KQZg== 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=csBRe6GCVEfaRNmTYDJTX2l/VpfE7TNuHayFgxQM24o=; b=Xv6asxni6kKyqfVB2iIeNS62yecQCOiS+tJ8B9spCD7ajIPjwSWXTlz6dDmgYbDfWJ KIchrx/1tYRUK706KoljsnVqrh2MLXAsxT2YlB7UH4yorbyeZkLPNoj9PzK3SM441n+H LB7i2Fp8q0ggXfGYU2Bg7ptkO8pGGwIxAFRdiDicLL+WP5ulmWg5L2Aoq+sKGsEQXRHG hjn1OIFbL/ds2AvqnfJkNU/vIM4SyTvyDpCaL9M/K2oHpWCOFbPmhtnRw5b+P8PCydQU hPEtzSarucaJJPEUZPfIZ3MrDm3WKDJK5eESdzuRSHsK9mh4Eq0uzpIYgRH4+pN3xqw4 Korg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=QZRcmT5K; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n2si708387edb.238.2021.06.04.08.50.15; Fri, 04 Jun 2021 08:50:39 -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=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=QZRcmT5K; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229925AbhFDPuS (ORCPT + 99 others); Fri, 4 Jun 2021 11:50:18 -0400 Received: from mail-lj1-f179.google.com ([209.85.208.179]:46971 "EHLO mail-lj1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229809AbhFDPuR (ORCPT ); Fri, 4 Jun 2021 11:50:17 -0400 Received: by mail-lj1-f179.google.com with SMTP id e11so12115532ljn.13 for ; Fri, 04 Jun 2021 08:48:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=csBRe6GCVEfaRNmTYDJTX2l/VpfE7TNuHayFgxQM24o=; b=QZRcmT5KadNWFjVQjJiemyr5SdfPveEFwW6PgIgkrNW0XBjGd9OvK0iQOuLwr71XMR stL/FJX5RLtW812HBNpRSycdp4S9aNlAPcBTVKmcp5N629lqvEDLXHFvmSO9sqxv6bOD TtL4hE6CV4TAxs8+ZISrfDHKyGOTNR++1q2+1cmvfkOcY/UHCsxKDlDVJFh9v4eFxyMB S7hMnTxn/z9/P82qloYQz2JtX4zDwjRcLKRYUMh5V0uttf2BpkpfSPzaZYXMdeVqPewr UfGDLn/tlVWYm9fW2Jl1ggJKYNSJtIjysyLkX5HGv6xUVMVe7cVS/CNxw5FJkC7ou0Ch xV7Q== 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=csBRe6GCVEfaRNmTYDJTX2l/VpfE7TNuHayFgxQM24o=; b=kSkspIy5Kzvg6RxOjxbDnUoki0j66Kf76kQwkL6QqnYwJg5NayKjyyjGoF5iNYFG78 GalYKtIfR+qpBKxoncYCbCMowqQmCGxXFvWv2jZdUB6gLWo+5d2R1t8gn9gruriwZzjS tgx4myPLzZA7h35xBKnOBknUPLv/9zrdP6kO5aA2o7zrIoCzU9HdmYUL024Iy6brz3cg wWjSEakPdekEPqj5HZhejatLqm64H3qtdTPTdek5fKUFBBxYwZaIF01nh2JkFMPEGvqg NcrX5iRkiz087asMSti8r7MOEXjQFiomoDyXbC1HCUDGnoMr3Rt+/BlUIoymg3M73CT0 WmAA== X-Gm-Message-State: AOAM5327qX3KIBxTqAi4w6ojXe6U5lUpbmbi4jJepP4Y8dH+fXebx3EC qGZNpYk90rQ1Y5N3/3NnUQKk8Q== X-Received: by 2002:a2e:2d11:: with SMTP id t17mr3902830ljt.56.1622821636863; Fri, 04 Jun 2021 08:47:16 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id r27sm647044lfp.95.2021.06.04.08.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 08:47:16 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 6ADE91027A9; Fri, 4 Jun 2021 18:47:28 +0300 (+03) Date: Fri, 4 Jun 2021 18:47:28 +0300 From: "Kirill A. Shutemov" To: Hugh Dickins Cc: Peter Xu , 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: <20210604154728.itpbqhwub5squt2u@box.shutemov.name> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 03, 2021 at 07:54:11PM -0700, Hugh Dickins wrote: > On Thu, 3 Jun 2021, Peter Xu wrote: > > 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().. > > I imagine you're reading that as spin_unlock(pmd_lockptr(blah)); > no, the lock is right there, inside spin_unlock(pmd_lock(blah)). Oh.. It made me scratch head too. Could you rewrite it in a more readable way? -- Kirill A. Shutemov