From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77481C6FD1C for ; Fri, 24 Mar 2023 13:55:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F11506B0078; Fri, 24 Mar 2023 09:55:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E996F6B007B; Fri, 24 Mar 2023 09:55:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CEC13900003; Fri, 24 Mar 2023 09:55:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id BBE4E6B0078 for ; Fri, 24 Mar 2023 09:55:56 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7B1FE1C612F for ; Fri, 24 Mar 2023 13:55:56 +0000 (UTC) X-FDA: 80603940312.12.1D6210C Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by imf03.hostedemail.com (Postfix) with ESMTP id 4EE1D20019 for ; Fri, 24 Mar 2023 13:55:54 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=shutemov.name header.s=fm3 header.b=pIsQklgp; dkim=pass header.d=messagingengine.com header.s=fm2 header.b="ZjcQ2/l6"; spf=pass (imf03.hostedemail.com: domain of kirill@shutemov.name designates 66.111.4.25 as permitted sender) smtp.mailfrom=kirill@shutemov.name; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679666154; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=EVVXoHGj3zpolObFfiWsoAlRi/eEAsJP3e63FytbD+A=; b=1jNkGNI7GYWKHSf29WimjHkKoM2LeK2KGLIMCTPXxEwx1Gopn13lCZCcwIQfqcZ4/vfS/i XNOhv/Gd+lByd5gbHa6WeCfDoisVrHt25V7tVVPGlzewOBu/1Hb4+B+Tq0rXjWM6MU1vgc xj2jll8amaV6CbunWchYjKwdnv0E480= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=shutemov.name header.s=fm3 header.b=pIsQklgp; dkim=pass header.d=messagingengine.com header.s=fm2 header.b="ZjcQ2/l6"; spf=pass (imf03.hostedemail.com: domain of kirill@shutemov.name designates 66.111.4.25 as permitted sender) smtp.mailfrom=kirill@shutemov.name; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679666154; a=rsa-sha256; cv=none; b=AU4sQeJXsEL3Q2XtnRjt+HNZByhYzvH/olAl9URQaboXBYybwiQrcB0bJIDmktVHaKgU+Z bHkFR4YrpHAWLx29hK6fcgggvCAN1VZOoe5NsNJ3vl+9zcBY+eC/ca16DxPwPuTBlPDUQr Y6YBpxVy2c2v8srf5tBau/OKyt2Bqyw= Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A51D65C00D9; Fri, 24 Mar 2023 09:55:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 24 Mar 2023 09:55:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to; s=fm3; t=1679666153; x=1679752553; bh=EVVXoHGj3zpolObFfiWsoAlRi /eEAsJP3e63FytbD+A=; b=pIsQklgpfxEk0u/z9hxuDIDknrxlXv4xfdljX13+p jN1lsGal37SgSQjrgB0dqSgvJPJ3b/7b9JAuhat9cX/FLAvwlL31n+qW1481lThy 1opasdhbwIhLpU7P8/hI1tBkreAohz0Y4vsQslP9bSsrXhRv10wOpjJHEMUDBSVs xTgvxaKXu96P6thUTGRwkb0saO5nuFBckuEH4/Ht3d3F3gQ6Vac8JfALo4ZPzTG5 vLm4aLmq+8uerGZ4YEEoG9fmnvs70G/CmnYg8WBPuSgoqVvVCVYWK1HBGu2m4m4F WVy8JzR3jzTsF+Cvfr0UdrCO95/YGy+802D5cyOU3rBTA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1679666153; x=1679752553; bh=EVVXoHGj3zpolObFfiWsoAlRi/eEAsJP3e6 3FytbD+A=; b=ZjcQ2/l6a2Veit2UWuHXGGVWqwSElmYN2qW4GH/iU1PoO93CvYp mNOlUjzRn8WGK+UEM+79m+JFuZ7gOlr9vt3mazPhuE4ytCZoMmuWBgok9d8qZ0uX pC/XLGcVxZ0OLA+++Mq8D357fwcz6ho+LgtkGt/NpNj253HGGrHqXz/95icqmLc1 ML/OLWMM5/YVaWc05+6dUpt0drJliBgFFh9o4mOZAxKG3ePFiT8SUSo9+hXQp0i1 fjZdDDbREYFd2N1W2/1sg0+LwSNnRl1jx6e2KpyMFKxUP98LklzQxeuznoEchwDY +80RGxG3dmsuCtdhTp6ehXymHzUEWYBgppg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdegiedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdejnecuhfhrohhmpedfmfhi rhhilhhlucetrdcuufhhuhhtvghmohhvfdcuoehkihhrihhllhesshhhuhhtvghmohhvrd hnrghmvgeqnecuggftrfgrthhtvghrnhepjeeiieeftddtjeffkeefgffgudekjedvgfdu geeljeehhedthfduveeitdetudetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepkhhirhhilhhlsehshhhuthgvmhhovhdrnhgrmhgv X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 24 Mar 2023 09:55:53 -0400 (EDT) Received: by box.shutemov.name (Postfix, from userid 1000) id 802F610A607; Fri, 24 Mar 2023 16:55:50 +0300 (+03) Date: Fri, 24 Mar 2023 16:55:50 +0300 From: "Kirill A. Shutemov" To: Joel Fernandes Cc: Michal Hocko , Linus Torvalds , Naresh Kamboju , Andrew Morton , linux-mm@kvack.org, LKML Subject: Re: WARN_ON in move_normal_pmd Message-ID: <20230324135550.q2xfuj4hjs7odbu5@box> References: <20230324130530.xsmqcxapy4j2aaik@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 4EE1D20019 X-Stat-Signature: hca9r8f4fmeadxxjoufee7e1w7jxumsc X-HE-Tag: 1679666154-122894 X-HE-Meta: U2FsdGVkX1/fcYVHFhj2PTfxIJ3hA6kA4mn6m6gwb8LfRp39Uo9Hd6iMFyaZLNC3AVwMfLgL+kO1/9+guRgsbadoLn9rNbG5gR487JB04KkSU68Fhe5n6XgAy9g1chYFYgoEqdHbxuuVZWzPU/WXkuOFpB+odhPU4eXSCUoyjJLQGFzYaE6djcoR6p053NMNG5D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KTflJRfJFPe0kiDa/GhjPynzuKXeBpgVbxYmpF67exyqA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Mar 24, 2023 at 09:43:10AM -0400, Joel Fernandes wrote: > On Fri, Mar 24, 2023 at 9:05 AM Kirill A. Shutemov wrote: > > > > On Fri, Mar 24, 2023 at 12:15:24PM +0100, Michal Hocko wrote: > > > Hi, > > > our QA is regularly hitting > > > [ 544.198822][T20518] WARNING: CPU: 1 PID: 20518 at ../mm/mremap.c:255 move_pgt_entry+0x4c6/0x510 > > > triggered by thp01 LTP test. This has been brought up in the past and > > > resulted in f81fdd0c4ab7 ("mm: document warning in move_normal_pmd() and > > > make it warn only once"). While it is good that the underlying problem > > > is understood, it doesn't seem there is enough interest to fix it > > > properly. Which is fair but I am wondering whether the WARN_ON gives > > > us anything here. > > > > > > Our QA process collects all unexpected side effects of tests and a WARN* > > > in the log is certainly one of those. This trigger bugs which are mostly > > > ignored as there is no upstream fix for them. This alone is nothing > > > really critical but there are workloads which do run with panic on warn > > > configured and this issue would put the system down which is unnecessary > > > IMHO. Would it be sufficient to replace the WARN_ON_ONCE by > > > pr_warn_once? > > > > What about relaxing the check to exclude temporary stack from the WARN > > condition: > > > > diff --git a/mm/mremap.c b/mm/mremap.c > > index 411a85682b58..eb0778b9d645 100644 > > --- a/mm/mremap.c > > +++ b/mm/mremap.c > > @@ -247,15 +247,12 @@ static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr, > > * of any 4kB pages, but still there) PMD in the page table > > * tree. > > * > > - * Warn on it once - because we really should try to figure > > - * out how to do this better - but then say "I won't move > > - * this pmd". > > - * > > - * One alternative might be to just unmap the target pmd at > > - * this point, and verify that it really is empty. We'll see. > > + * Warn on it once unless it is initial (temporary) stack. > > */ > > - if (WARN_ON_ONCE(!pmd_none(*new_pmd))) > > + if (!pmd_none(*new_pmd)) { > > + WARN_ON_ONCE(!vma_is_temporary_stack(vma)); > > return false; > > + } > > Wouldn't it be better to instead fix it from the caller side? Like > making it non-overlapping. > > Reading some old threads, I had tried to fix it [1] along these lines > but Linus was rightfully concerned about that fix [2]. Maybe we can > revisit and fix it properly this time. > > Personally I feel the safest thing to do is to not do a > non-overlapping mremap and get rid of the warning. Or is there a > better way like unmapping the target from the caller side first, > before the move? Making it non-overlapping limits randomization effectiveness. We need to quantify it at least. -- Kiryl Shutsemau / Kirill A. Shutemov