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 D8D16C48BF8 for ; Thu, 22 Feb 2024 21:19:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E8656B007D; Thu, 22 Feb 2024 16:19:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 598116B007E; Thu, 22 Feb 2024 16:19:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 438E96B0080; Thu, 22 Feb 2024 16:19:58 -0500 (EST) 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 305366B007D for ; Thu, 22 Feb 2024 16:19:58 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id F081E40F09 for ; Thu, 22 Feb 2024 21:19:57 +0000 (UTC) X-FDA: 81820707234.03.8A9BE4B Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf10.hostedemail.com (Postfix) with ESMTP id A7AD9C0013 for ; Thu, 22 Feb 2024 21:19:54 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=nTH7S3Pa; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=klL58VXW; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=nTH7S3Pa; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=klL58VXW; spf=pass (imf10.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708636795; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=Nmwy2si2pJ2mNU0MlM/z5AaEWl08Athx/4vltay9xWM=; b=XGijIKQ/eR4Cn1TYytewL6vvSG6ctp0EYk5DqrzSwOGuIln7sjBF9C7cMeXwz5MrU0MA73 k3tYao+sdbqRRuSGwXqSmnyCOwE/G5Os5jD5WTP24bu268sOeR76iYLZ1FJGpTUEIqglvl 6ZwtLkILWg+q1cmeVbFuxIYWjfZlUZA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708636795; a=rsa-sha256; cv=none; b=FqXUE6SVH4n4TbhuRETOjwtDmCm+J6Jvb2Rr34G06TeIEiXQmS4jOeCXbpTNCDy1KQoCr9 4Elpa4RraDWU15Je8ROThXh+3223A8GNGnHKA27lhM8NH2TXDX9Dd8lf30m6nDkZFoz5fI +UeztTi/lBO1PbQHqNGRSxzhfWmhvxo= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=nTH7S3Pa; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=klL58VXW; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=nTH7S3Pa; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=klL58VXW; spf=pass (imf10.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 9F4231FBB6; Thu, 22 Feb 2024 21:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1708636792; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Nmwy2si2pJ2mNU0MlM/z5AaEWl08Athx/4vltay9xWM=; b=nTH7S3PanwNm0vSUAJGfofhoWbap77NuQWPXpHbQ1p7+vVMIlw2H6L+4fv8xNbT/5bIVRP /phzpnBch87802xFXGhA3UOKXzuh7SlC2vBUXS0vISLNPddWML0M4zO+Gz7M2RIoHO02DM haUdYTIkowYrr+g/xV3yoByT2O9W+8M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1708636792; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Nmwy2si2pJ2mNU0MlM/z5AaEWl08Athx/4vltay9xWM=; b=klL58VXW0qULmuuzYQPKnVJUsqc30dJTQ/BQnFmCOK6IyMR2r2OHG7tTqCzhoo6DGh+Dxd LyCGHxjDZeogT/Aw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1708636792; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Nmwy2si2pJ2mNU0MlM/z5AaEWl08Athx/4vltay9xWM=; b=nTH7S3PanwNm0vSUAJGfofhoWbap77NuQWPXpHbQ1p7+vVMIlw2H6L+4fv8xNbT/5bIVRP /phzpnBch87802xFXGhA3UOKXzuh7SlC2vBUXS0vISLNPddWML0M4zO+Gz7M2RIoHO02DM haUdYTIkowYrr+g/xV3yoByT2O9W+8M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1708636792; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Nmwy2si2pJ2mNU0MlM/z5AaEWl08Athx/4vltay9xWM=; b=klL58VXW0qULmuuzYQPKnVJUsqc30dJTQ/BQnFmCOK6IyMR2r2OHG7tTqCzhoo6DGh+Dxd LyCGHxjDZeogT/Aw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7A69513A8C; Thu, 22 Feb 2024 21:19:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id GnyhHHi612WzKgAAD6G6ig (envelope-from ); Thu, 22 Feb 2024 21:19:52 +0000 Message-ID: <18565605-7f68-4950-b66f-496c1f3c393b@suse.cz> Date: Thu, 22 Feb 2024 22:19:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mm, mmap: fix vma_merge() case 7 with vma_ops->close To: "Liam R. Howlett" , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Lorenzo Stoakes , Michal Hocko , stable@vger.kernel.org References: <20240222165549.32753-2-vbabka@suse.cz> <20240222185642.rmnp76oquu5wfo6c@revolver> <20240222192746.cb65qvtmhaikfeko@revolver> Content-Language: en-US From: Vlastimil Babka In-Reply-To: <20240222192746.cb65qvtmhaikfeko@revolver> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: A7AD9C0013 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: tbi3qzn8mbpcubieuo8a3aurbfxp5pm1 X-HE-Tag: 1708636794-223266 X-HE-Meta: U2FsdGVkX184RZFsuU7SFR/MKsQ2iyu0/oIRUBW7mSKG/xLRegBH+m4Srz3pSMVejU/1G/snPAPAnmWTXXBu2UxsyEXBDvA++K7CO/hZIk7RJh673qanNooUAoSBDnzIByIDW2QeXs5HHhvxxkm6YNf2cGgIIO8Oje4LZbYM5nAEnwy7hTqBs89xukSF0rbzgOcTzTiYvtdSANrHnoHJTZi7m88OR0DNLTrNkviFGuqImuOyyly/CuG+rXBybAzgg4bdSJQCGYAnoVJTqe83n8IT0OHY7cyd9Scogw9vR72IavG9ONoMAHl09/iJQR6VZDDjlk6N/aEqOb1XtHGgPPW6DvpDFGqM0GYEwjbF630X3pUZskAV5LoEgUwy6iSHveaMIZxSHbxQAVb9g6Z/WWR/ba4154VqziPWx+m+GEPs72fjXCgCsCecPuxGCPXOwLQwn1d/6xmKPLVwcgCsiPXF2rwj5RvCsmk6zKam9ukyEFK4Simum+7j+apVyBjO0PEnKJX9L7zx9wvffq0gH/z6GRxb6/4FwJh08kyzVUUCbUx6pihbI3qTy9FW+B3xN9BNLZ3B0rpyBP92Sdo/LiN7WpTS7bbSq2OkE0Cy7yUX9UzaVIDkcElJigZXT9bVJMOUIW1wq0DaEnsSIa+laSrKDzzI4RgzBQxLhwssEbyUtswssSt+Sf0f9hFlVgT4NuWFVbxss1Ya86N8WzhiUJXNd8HR8zS9h303ckUFB+EOuztMZEYFOUpyv49PhtR02AzezxFpmQ71vyXy1lzeBnHwxo6a49SrdUs9ateMfqdcNVf45wAXDT8UyGTRSAm58U0KC/KjrAMgYFY7xz+55VNZGRG1qnVaSLML4CGDRkkdsz0N4LkMGCn94GCInqVof4bBetlVwYIkyfH3GvX3h3qW/KYhQ3CBa6qoa6db8DpsAoQmC2Vb8yGJrb8sP/FfJ8EDeCGublS0pKKWATx RH7vBo6J hui58XK9istFs1M4= 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: List-Subscribe: List-Unsubscribe: On 2/22/24 20:27, Liam R. Howlett wrote: > * Liam R. Howlett [240222 13:56]: >> * Vlastimil Babka [240222 11:56]: >> This separates the check for potentially merging previous to a later >> failure case. Would it be better to check: >> if (curr && curr->vm_ops && curr->vm_ops->close) >> >> and not set merge_prev = true, ie we cannot merge with the predecessor? Good suggestion, thanks! >> That way we would exit as merge_prev == false. >> >> We would have the added benefit of not having to look at merge_prev & >> merge_next case with this vm_ops->close in mind (case 1 and 6).. because >> I'm pretty sure we can currently get to case 6 in this way: >> >> merge_prev = true >> check for merge_next.. can_vma_merge_before(next...); >> is_mergeable_vma(next.... , true); >> if (true && next->vm_ops && next->vm_ops->close) /* Fine for next.. */ >> >> Remove curr by case 6 without checking curr->vm_ops && >> curr->vm_ops->close >> >> If I am correct, then are we blaming the right commit? It was bisected with no nondeterminism in the test, so yeah. > I am not correct. > The file check will ensure the same ops, so the file and ops must match. > As long as both are checked on one VMA then it will work as required. Right, otherwise we would have bigger issues even before the buggy commit, we were never checking curr's vma_ops before. >> >> Perhaps we should just fail earlier when we find a curr with the close >> ops? > > I'd rather fail earlier, but it's not a big deal. Your suggestion will indeed result in a nicer and more obvious code, so will do, thanks! >> >> > } else { /* case 5 */ >> > + err = dup_anon_vma(prev, curr, &anon_dup); >> > adjust = curr; >> > adj_start = (end - curr->vm_start); >> > } >> > -- >> > 2.43.1 >> >