Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp472212rdb; Fri, 26 Jan 2024 00:51:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGF/Ca5hpdhr27DngAxSXns5zOnbSQnpdtDLFn2lGSinqBkBuLnUIECPqOE1TYIR0iMheu X-Received: by 2002:a05:6358:524b:b0:175:c7bb:5bb8 with SMTP id c11-20020a056358524b00b00175c7bb5bb8mr863173rwa.65.1706259110299; Fri, 26 Jan 2024 00:51:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706259110; cv=pass; d=google.com; s=arc-20160816; b=LHc8ewH0MFkdNB7qrhGcjmVh8CJDuWhcxdGNGqFyrodhsbbe/boi9EOzsn8qoVJdNu msoZtewhloXHSZnVQPV3t2Jg1IbOCcWxY1sHSe6TpfyT4m9vK+xMFcFiqdLr10aeF1jT 5Ytr/Pv9mUctlTeRMeMc5GK4aQNwLpwc8TBVa6PJo/d61pVrYRDqj06U+lM9BBXIYujh WRFhCTV7dRNVl/O7AG/VssodeEulqNialkm5jcr/a1GloIjPq5KtlKQV0fkdfoZjp0Tq Txg151Adtorvf+/AZ6rg52MPVxMRvRhTcG9FAadeyT4T+gtYGd8oROf/dTLOggsQCius 6exw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=K//+qEtbvSyqWiGx8WtkDRBDbsRbJpInUNmggqit5fk=; fh=inSS35aZQAlreHe/dcU2z1ZyRcKtx3OY9um7SYlatM4=; b=oM5OwzQWJrT+Oxf/nJhDTjb5nLCLWkmKX2++CdGSP92zQGdG2TkZM6rkeU0QT1INRH LzIzG5Ck6+17gbxPgmveLFBBw9+ndpDONSInnrDU9uGN7bD9E848zGloHOpXLSxF16FQ lFJodj3f36FD9LzLIuVYQW62L6dcXLbgAYc+XL15fneKO3Y41cIW16tpvzGdjIQwsE7I Wof4uMS0M9IAC3hFZ/ZrRadI7/F+ogKLFlf/IAGXpz88kTpr72I9SYNQ8WtRm/MSEW0c dkIbGzKUysapha7K79//yMD9K9oUwwwZM/gUpoY3tW1f2gVmFDlSOWAcwExOQzkOcQ+z xs4g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=eGjdKbwF; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-39674-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39674-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id z11-20020aa785cb000000b006dd9f0a3874si808735pfn.225.2024.01.26.00.51.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 00:51:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39674-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=eGjdKbwF; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-39674-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39674-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id EA2842876BF for ; Fri, 26 Jan 2024 08:51:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43DA4208C8; Fri, 26 Jan 2024 06:53:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="eGjdKbwF" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 12B5B18E29 for ; Fri, 26 Jan 2024 06:53:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706252021; cv=none; b=t1Hw3PNfzNP6K4aRHMs9ePb3bHmINjuiE2LXEjeVUA68FtmAWJPnGmN/z0TcLskfd9JqeFIr5566qs2Pgp+Sz2KwegRvSU+WgoT/PQ0JH3qyvYSKwrf/Ttjzzq5m29tyDiqB71W+xzj6mF7Xr8uX64+ycDPOEMdO45KXrLY+xQo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706252021; c=relaxed/simple; bh=5Yl9F+CzoZAtWpDOn5PuDO6yaUyXOId5gbApjRdJtCg=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=QQ0b5mRb5IUKxSIiBq+nlXiYp+KPDGgLKpJF4BBLlqcOtSWi32vfbH9PKCKJ9Wn+9HEeBz5VBOyalDMOiJkKpzAGhkXoCn5SYTZDZBeOwvJzlymWM9VAx/CsrpNzjFxq6F+wYvYBVr30D6iUs9RIdvxtF1Sb4K5Y2Wg3y4gjk9Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=eGjdKbwF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ACD2C433F1; Fri, 26 Jan 2024 06:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1706252020; bh=5Yl9F+CzoZAtWpDOn5PuDO6yaUyXOId5gbApjRdJtCg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=eGjdKbwFc9UxRkSyUUzwJbhtW8McrA527Ae/OLxda04DU7du3mvcIO2ZW+Xm7oOIM 8dlvGytlqESnRE+vm5e4nUA918xJjIt0zcKBrYpjmhzP7gV5+yZgOuWGAbBW3BDq5/ nvZf1i1uzI4LLde0Mu4t7fkFM/Jw8AD5Tjv/Yxd4= Date: Thu, 25 Jan 2024 22:53:36 -0800 From: Andrew Morton To: Sergey Senozhatsky Cc: Jiexun Wang , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] mm/madvise: don't forget to leave lazy MMU mode in madvise_cold_or_pageout_pte_range() Message-Id: <20240125225336.6a444c01d9d9812a23a6890b@linux-foundation.org> In-Reply-To: <20240126032608.355899-1-senozhatsky@chromium.org> References: <20230921174101.8e6271422a857af5414ce0a0@linux-foundation.org> <20240126032608.355899-1-senozhatsky@chromium.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Fri, 26 Jan 2024 12:25:48 +0900 Sergey Senozhatsky wrote: > We need to leave lazy MMU mode before unlocking. What might be the userspace-visible effects of this? > Fixes: b2f557a21bc8 ("mm/madvise: add cond_resched() in madvise_cold_or_pageout_pte_range()" > Signed-off-by: Sergey Senozhatsky I'll add a cc:stable. > --- a/mm/madvise.c > +++ b/mm/madvise.c > @@ -451,6 +451,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, > if (++batch_count == SWAP_CLUSTER_MAX) { > batch_count = 0; > if (need_resched()) { > + arch_leave_lazy_mmu_mode(); > pte_unmap_unlock(start_pte, ptl); > cond_resched(); > goto restart;