Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp765249pxj; Thu, 3 Jun 2021 20:01:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmhvAnD/geuAUKTI9MkqXsJs4nAdSPXO4jjQqwt7M2Vg8VrpBJy3egjGa6Sy5WyENMwQ9G X-Received: by 2002:a17:907:7848:: with SMTP id lb8mr2175133ejc.494.1622775691331; Thu, 03 Jun 2021 20:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622775691; cv=none; d=google.com; s=arc-20160816; b=JmL1Wxufst29yOkuD9OzfpXhpWocF41LLmxA94Aliv4Kjt7zfT0NtUgE28WoX5Ew6u +wzDDszk3HdRzJRoS6S8Lz4+lafrqbHAdyGA2a5Lx/b2d0Gdx+bCLhUyT/PFg2mghchF sO6CUPHAUucaSvrSpOtk1do9UkXIaODl8DyWY0EEfCG+MsBatrm44sgdf40I19uxAU01 ihit4pFzJILV1rd6dpMUBRGEvjYkMy62QpBDbpbPE2TXxwD4qysd6jQ8DscRDMgmEicI IfQIsjTF6QWhg+/65jZGTzYeoRXXPXZRsElbnpBS5vp9pK8Q4yEjr7a2QMCuQ+FYg8oV HSag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=tzIVv+lKCCHH2FflktthX9wxyuJutky8QPa/YVxWuE8=; b=ALBxN8ejQ0u7zW3HRE/7kXHOTb6YVY+yYr+U2sAckL7GfE80hfUYHLMzhtnreF8z52 52Pixe9r/jXyLctNGH3HbIhasq2+wGztQiarghu1Y6Ii3I7tOGBev0Yv9LMtqjnlokTH uE7BU5JXlppN39U/iz94LZmyMLTJ4cnrz6IfnZ/sDwDXRgTWpMGD0etZHd9iesgix6+S Fj6uEaKlkPI+uZDCIkKAJJvPJMmswb/wxbvPRtHNN3Qcnt/TsbTOndooWlI89Ps8gDxH b9o8jN/OPqE/q0PlpdYcaZpYdhTHLgaOflKdTtEgqD5AScjpmazH3SByqk93hBQd5Meu HmUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ti9OjQCN; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s19si3817311ejj.534.2021.06.03.20.01.07; Thu, 03 Jun 2021 20:01:31 -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=@google.com header.s=20161025 header.b=Ti9OjQCN; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229828AbhFDC5B (ORCPT + 99 others); Thu, 3 Jun 2021 22:57:01 -0400 Received: from mail-qv1-f44.google.com ([209.85.219.44]:37415 "EHLO mail-qv1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbhFDC47 (ORCPT ); Thu, 3 Jun 2021 22:56:59 -0400 Received: by mail-qv1-f44.google.com with SMTP id z1so4293345qvo.4 for ; Thu, 03 Jun 2021 19:55:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=tzIVv+lKCCHH2FflktthX9wxyuJutky8QPa/YVxWuE8=; b=Ti9OjQCNoW3/TjQWP9o9zmOfFPCPJeIKzDZ0oWm4SfHRiekMW0qWopTYgy5cvt5CRb I2he0vPPCj/OssW9bMaLKi6txZuMaGO3JgH0unSpauH7iCNI62j+UsBAdWvxAnxcaA9Z mZycVBh110e+zgGQ8KbpoYpdp1/XUpLT7+mO6zc7F6Z0nIU30OlrdhzDEyI+WgejoOIM BO4DNd8qxMjBkU3x+tJfAir4gBxhvouo1BEmddnjzz5qW84fYypyRLhGQXdD7B4jXgL/ VkWvTqxW2hlq1T9BH850dmsW7SRszqaOJLwnqZjb29oUxkSCNeHwaXH08HBxV4Xhvh19 d9XQ== 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:in-reply-to:message-id :references:user-agent:mime-version; bh=tzIVv+lKCCHH2FflktthX9wxyuJutky8QPa/YVxWuE8=; b=sFB22//lENjdnq5dCC31IL5WbK8PXAllXmL8ix+UuHPMfl4EOMAGSrC95g5+ftYOdf 7LN4sxBJgfK+C0/3FM2ejVoRYxdUfNdRDtphW9yikFtJNKFeUefaX/L+xsCKqsXcZOGT 1O9Akw9pdxKnda1zH1KQ/0K9U4paTgXVRFwrYobwXxQACsYk8B/vJdgxJwnMlRiHSFAa fURL/z4K7Qpy2B4JFGHxFzx0dJvPX/Rfzi2eCoj9Ld5nBQyHY50cBNKOcPN4xC9eiTuB 5gFjrQ4KOac3BHQjyEQ1fPO/K/c1rbYy7PM6uPfwfcE8Ta1iJs3Wxt62JnkaRlqFUU0m 1q7A== X-Gm-Message-State: AOAM53324GYYk9PoZJDCGUhqtiXcNCkn6tE+gMbjWMR+47QTf/EHX++6 l0ieLZDZSJdxphOOaIR8CVWjRg== X-Received: by 2002:a05:6214:485:: with SMTP id ay5mr2811633qvb.6.1622775253981; Thu, 03 Jun 2021 19:54:13 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id x18sm3110686qkx.118.2021.06.03.19.54.12 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Thu, 03 Jun 2021 19:54:13 -0700 (PDT) Date: Thu, 3 Jun 2021 19:54:11 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Peter Xu cc: Hugh Dickins , 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 In-Reply-To: Message-ID: References: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)). > > And.. isn't PVMW_SYNC only meaningful for pte-level only (as I didn't see a > reference of it outside map_pte)? But you are pointing directly to its reference outside map_pte()! Hugh