Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2496281lqo; Mon, 13 May 2024 23:42:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVR7nCmehBSrJbqsa7FS3wf3ezhz8Mmqf89PAG8voVu3lIQv6T9i4K+ryrPqj1ZR8GYkTb5Cf3+W60jL1smFiJkyvsYrIce2jG7nYv9jA== X-Google-Smtp-Source: AGHT+IHiqVWHcGTWlTcFM2diehMA2f93W7s6Xr3KB6jQxzodLctYEYpz4emGNLpopgbBKJtM1483 X-Received: by 2002:a05:6830:2005:b0:6f1:143c:3c33 with SMTP id 46e09a7af769-6f1143c3debmr2906797a34.21.1715668927366; Mon, 13 May 2024 23:42:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715668927; cv=pass; d=google.com; s=arc-20160816; b=fA9KVwpTNSFA1qe6DsB7YRgKCnrWNnWWswAoGIsK9i7Cis9l43LXhKvbLsEOI/Ltop KxvcyDPZs0PpnxIDaUU5OoLLoIyXr0u3oJ48M7B7IIUnpUcgh6Y8g/01VNAuR09WwisM zi9Yp9TrEPCe98J2/Htonpa8j7L2ZRnYbzMxTuYXL3NgiXGBND8yEuqDfyj8EJAP5tR8 s2BTuXPLptojXskpEgFo3YYqItoilz+DyTConbuEWjh/s5ezZ+LFcr/FTNibIPEsEuBI Ak2Aqec/kFbuxVG2kS9cHcUPvZXpVZFb1pxYg+Bt+3mUAiNkaCdnMkkYk6FZDSuTH69Z GeEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id:dkim-signature; bh=qq9BIghgoJ+LZ1XpMSxI2larmjAnvQoJQ/47VqjuHhc=; fh=j0i9f6ASMh54zaRtcXzHHGA1bbTtJWxpSWf2qJ+wsr4=; b=KoZAx49VmUxyKpMgF9KlPjkNKXkrWcANlWY63qsJ5ORXXFDh4ma7bC+x7TKj2Z4c1d quIcOWyGsNFsNaNXHcq4QctfnaAcN7MaYGIN8bszTI3Pjr+t8EL8VaTfA/nKnjQxtAA1 i6430EQOewil/zM/1Yt2YjxiV5BjN71Hteq4kwCt+r0WUpIujsYq4auZCBvHDXn71jU/ KXCE6dqvp7b18heLpWUf70tv6RCwLR0bqw5nKMHVFvBQ3T6V0kVyHMxsFnmcswzNZUYU 3BIVAF9kwCg8NvTJJAjtAccI0CYsohIIBK9Os/5QZxS1O24XiQArTrQQ/H8ORrP/zNN3 Sf+w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=JRvbgVHn; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-178350-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178350-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-634117190b8si10793170a12.506.2024.05.13.23.42.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 23:42:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178350-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=JRvbgVHn; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-178350-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178350-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4606CB210AE for ; Tue, 14 May 2024 06:41:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3762AE545; Tue, 14 May 2024 06:41:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="JRvbgVHn" Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) (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 2C2A9386 for ; Tue, 14 May 2024 06:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.119 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715668902; cv=none; b=jgFKbXePa3y25NKlIzngJK3dnUVwPoSwOh0pqavmlkCVrhHnonA0v9FDYtFdz/vnRd3ILWM7jN0RtnqR985AqQJGhiECcfJCNwCrpmsnSwhRqWfAVhZFC869+jN5XffacZryH10wZvNrQPQnmx6Ldb/y3rkXwsq5bZrxtjSfJzw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715668902; c=relaxed/simple; bh=lnFsYaVZ9mk+akNFRVvwXwFr24R9BjCu6nIkuWkhF6k=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hFPazaMMDerrXDN0fMrRwErrAKGXA2ECNFmIBSGvmK4jKwUZQIIDXfpLWLjAPX1TC8DOvZ8YzQNip4aRMIKQiI5EXD/JKnlNgIC6ypl7Pf/4Rk00TMig24sywc5C9gipIy8ahoW1E6E6JauYFDEIHoH5s2T7VKmKwB575qpCoQo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=JRvbgVHn; arc=none smtp.client-ip=115.124.30.119 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1715668890; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=qq9BIghgoJ+LZ1XpMSxI2larmjAnvQoJQ/47VqjuHhc=; b=JRvbgVHnVOCOxk+LgcNUGZjP8LE9HWYrqeeUvbc63kjUEKPW05as9t+dUypSHwCq1+Si61jgtotiPYW26ESh6dg1yT+CmANLGRXnVMXPIGJk477hEVzplODvGVI1QTexoLjWtk3sTPBCc/19bLMG4PJYmvL6kXZOePvK3X8Yu0E= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045046011;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0W6TyffK_1715668887; Received: from 30.97.56.67(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W6TyffK_1715668887) by smtp.aliyun-inc.com; Tue, 14 May 2024 14:41:28 +0800 Message-ID: Date: Tue, 14 May 2024 14:41:27 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RESEND v5 3/4] mm/mlock: check for THP missing the mlock in try_to_unmap_one() To: Lance Yang , akpm@linux-foundation.org Cc: willy@infradead.org, sj@kernel.org, maskray@google.com, ziy@nvidia.com, ryan.roberts@arm.com, david@redhat.com, 21cnbao@gmail.com, mhocko@suse.com, fengwei.yin@intel.com, zokeefe@google.com, shy828301@gmail.com, xiehuan09@gmail.com, libang.li@antgroup.com, wangkefeng.wang@huawei.com, songmuchun@bytedance.com, peterx@redhat.com, minchan@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240513074712.7608-1-ioworker0@gmail.com> <20240513074712.7608-4-ioworker0@gmail.com> From: Baolin Wang In-Reply-To: <20240513074712.7608-4-ioworker0@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/5/13 15:47, Lance Yang wrote: > The TTU_SPLIT_HUGE_PMD will no longer perform immediately, so we might > encounter a PMD-mapped THP missing the mlock in the VM_LOCKED range > during the pagewalk. It's likely necessary to mlock this THP to prevent > it from being picked up during page reclaim. > > Suggested-by: Baolin Wang > Signed-off-by: Lance Yang IMO, this patch should be merged into patch 2, otherwise patch 2 is buggy. Quote the description in the 'submission patches.rst' document: "When dividing your change into a series of patches, take special care to ensure that the kernel builds and runs properly after each patch in the series. Developers using ``git bisect`` to track down a problem can end up splitting your patch series at any point; they will not thank you if you introduce bugs in the middle." > --- > mm/rmap.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/mm/rmap.c b/mm/rmap.c > index 4c4d14325f2e..08a93347f283 100644 > --- a/mm/rmap.c > +++ b/mm/rmap.c > @@ -1671,7 +1671,8 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma, > if (!(flags & TTU_IGNORE_MLOCK) && > (vma->vm_flags & VM_LOCKED)) { > /* Restore the mlock which got missed */ > - if (!folio_test_large(folio)) > + if (!folio_test_large(folio) || > + (!pvmw.pte && (flags & TTU_SPLIT_HUGE_PMD))) > mlock_vma_folio(folio, vma); > goto walk_done_err; > }