Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3448569lqp; Tue, 26 Mar 2024 09:21:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUytpLUguALBa3+BlcAOMySGvJe+iKQH8/XB3kHIMvcAjlwkfMr6hBLgIdB4slgv1bt21L1e3yH+R+HgFZfTB0CQJrA4kYhHtSPezSvvQ== X-Google-Smtp-Source: AGHT+IG4l9gUl46ScvitDhosjOYtcu+zYG3cqCqysUrPgLu3OzSWBayBxednb0XEElW3gP8npPW6 X-Received: by 2002:a50:d60d:0:b0:56c:274a:31df with SMTP id x13-20020a50d60d000000b0056c274a31dfmr210969edi.5.1711470083095; Tue, 26 Mar 2024 09:21:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711470083; cv=pass; d=google.com; s=arc-20160816; b=VTq+Bv2ZMPUQLyYAAqOBv4mH2FBw2+YiTFFNIJM0kJRkZc2uaNjpLxBdoqv061tgEl OWFimqOJLHPt6DyZcSKE9ISlqCSQmRMLBkqIysq1gnGixnjJminrKYunf3r7j/JjhS6p 8BY73S0rtpum/CEpFwJEIGN5Vcs20HDadYlIBIYqn9dfUE5oJvtTcwy6Ru8+msVMeepi 5p9z5JRs1ztH5V/6+D3kvRD2gGsGMXBu9BdWU3AdN1DAYxiqdc2WqAy/jKtpoHcE273E 76EiO3BSS/VOn3rfiGQbqh33tyLb20IQyLR4wuVLcJw5WDS33l8sJ2QiW9oikyDHjBTr tbig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=oC7GMMoc4TX7QJB9CFxd5TJEBoqTJwxJZ30aIl5Tde4=; fh=trYA0LodjW0GqaE+5x3zn4y1SsOkOQM5Y/bzzi08s+E=; b=ndwQ754udP2SUKELekDJq5D0L8peQm3q/lGhvzBpvbQQD9P2x9cylQ9gpwoGRMF3tV D4pIHVVBgl7PhYUt1puzBQX0Df7z5qVy1+uKRphyBdGRGM0NKj6A8LcRPix03UdyZ+NV PEJzE0M/g43ajmk0JMS9baT8s/+YmQvh0tA4Tk/jCey0IfwKmdLA7Idx+/8G5KZr7ojg ocASFuobinEQ4P9qOTmDjLMINmEd85N5dIwTXHqqDk0SJmDsLq2/XvKa1P4rAuQt7U14 HXJXoexQJWWUbGzOY5fIdQhTVgaISDd7yADm4jtLk2zswlikpL3L3f9vrTQ3YsnaI2J0 llVQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=UwQd4PB1; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-119446-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119446-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b61-20020a509f43000000b0056739aba263si3649605edf.440.2024.03.26.09.21.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 09:21:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-119446-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=UwQd4PB1; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-119446-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119446-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C889F1F677D0 for ; Tue, 26 Mar 2024 16:21:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E90713C9D6; Tue, 26 Mar 2024 16:21:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="UwQd4PB1" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2E1213C9B8 for ; Tue, 26 Mar 2024 16:21:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711470075; cv=none; b=Y23fv2JAS669e6WhISusTVoub/YXObGui7V5xUGmg2yVrWqtBSfKJej0tXBj1DZzTFO1Fiqxh3scjMGgTj5B5S8oaz7jprp95jwx7iBexBU+wAuCtC9xXE8VklkZTCgImziUpbnR0n4w4ziEh0I08kq5N42iwOSK6JPBwHWLJRU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711470075; c=relaxed/simple; bh=qEt8XWA5kwdd1L+VuUKcVMN/aXLxa/Lf4+F4asHjhx8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=S4+x3nrtF2HpF0FsJmhNwCi5BQ6sqmdJnI1XlzlLZJtkQ3de1pBjTPPToPGDSgCKGv7SQ+S6patETlvspOU/U+mecHDjYUV7Qf2zCAJH/ElLwAE30iplZ1lR7OGog1DGIyzfXi+afNdRXU6He5mL3X7o2lb+g7zjLNRcWb5gylM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=UwQd4PB1; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=oC7GMMoc4TX7QJB9CFxd5TJEBoqTJwxJZ30aIl5Tde4=; b=UwQd4PB1/rRfPc76QXBGtisIBt BpL8Uk7DpRbeB51yNcvOMzGP8jWTSKd6o6JTUOsXA+qFoVmd9QDx+QZ1fz1ESihL/+oCVk09yhW4g sS7SDCc0kQz6yowlHTWTFUraGMqwVt88Bty9LBcM/Q+XNPZDLB3GfQrVZ9uN3Bj27kpd++M19QA8J patktrpCFQVzxwJeDSTk/Pc1y8A6xYJbDRTkOVwwy3eNo++fIV1tkFckWRgYeIahMy5pD58hRGgzT zkHKxp3h5DIFUQSYxcwKaSwx9SlnPBdkXDwIgpYyHZVsUY+3qa03id+qyu7bKDFBrrgM8WAZq+y1X gYSLQR4Q==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rp9Xp-00000001dxi-1max; Tue, 26 Mar 2024 16:21:01 +0000 Date: Tue, 26 Mar 2024 16:21:01 +0000 From: Matthew Wilcox To: Barry Song <21cnbao@gmail.com> Cc: akpm@linux-foundation.org, linux-mm@kvack.org, chrisl@kernel.org, david@redhat.com, hanchuanhua@oppo.com, hughd@google.com, linux-kernel@vger.kernel.org, mhocko@suse.com, ryan.roberts@arm.com, shy828301@gmail.com, v-songbaohua@oppo.com, wangkefeng.wang@huawei.com, xiang@kernel.org, ying.huang@intel.com, yuzhao@google.com Subject: Re: [PATCH v2] mm: hold PTL from the first PTE while reclaiming a large folio Message-ID: References: <20240306095219.71086-1-21cnbao@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240306095219.71086-1-21cnbao@gmail.com> On Wed, Mar 06, 2024 at 10:52:19PM +1300, Barry Song wrote: > if (folio_test_pmd_mappable(folio)) > flags |= TTU_SPLIT_HUGE_PMD; > + /* > + * Without TTU_SYNC, try_to_unmap will only begin to hold PTL > + * from the first present PTE within a large folio. Some initial > + * PTEs might be skipped due to races with parallel PTE writes > + * in which PTEs can be cleared temporarily before being written > + * new present values. This will lead to a large folio is still > + * mapped while some subpages have been partially unmapped after > + * try_to_unmap; TTU_SYNC helps try_to_unmap acquire PTL from the > + * first PTE, eliminating the influence of temporary PTE values. > + */ Please wrap comments at <80 columns. The easiest way to do this is just to pipe the block of text through "fmt -p \*" (need to quote the * to prevent it from being a glob/regex)