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 B8FCDC25B50 for ; Mon, 23 Jan 2023 19:18:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 327866B0078; Mon, 23 Jan 2023 14:18:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D72C6B007B; Mon, 23 Jan 2023 14:18:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 19FF96B0080; Mon, 23 Jan 2023 14:18:42 -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 0C35C6B0078 for ; Mon, 23 Jan 2023 14:18:42 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B43F9A0A01 for ; Mon, 23 Jan 2023 19:18:41 +0000 (UTC) X-FDA: 80387025642.27.51DDFDF Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf29.hostedemail.com (Postfix) with ESMTP id 8AA4C120002 for ; Mon, 23 Jan 2023 19:18:39 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=JUxt9xlr; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf29.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674501519; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IwnHNTQFcQb01gBYPKpdSxIYM/5A8BBiqgukBcwCA74=; b=RCW62z3bN4w1Mr7iAbmdYQT861lR54gVkl/6AUjbGaEdSzNcnYbzMPLhDWM1MB4ao6YD5K cPBGyxBRGdKoRof+rYTIodCLtp+fcTiBwPWRzEUq1hwvbgr1CO59dQ58fD2iD16ovbiQlM J1E1T3DsAghOnUpsuXbfSo2Nn74+yVs= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=JUxt9xlr; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf29.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674501519; a=rsa-sha256; cv=none; b=AjNrsZLXy+YFwps9tW2EOLCLQh0XGUlpWfPozMpF9ND7Wt2KqrN7CweHf+cz9vcB6utwsx U2qNTFJfd5XGWEAsV4jfXEWo9HrAV5dSjt928drY0TilpP5pM2CDOKc0LsQwPnLK4tABXv CMEKh6LdFBgVSlVL5gEJq0zhDqjbVb8= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D88981F38D; Mon, 23 Jan 2023 19:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1674501517; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=IwnHNTQFcQb01gBYPKpdSxIYM/5A8BBiqgukBcwCA74=; b=JUxt9xlrd3LgkvlvoFN0EQ4jwlcdyUlX8q9x3WmrxamRn53nUj5FSlg3bsj2ocxy8rD/Q5 ISzd1s5PZbyEdgu0lzE9O8aWDcfuIWnMZns0F2ydDQ+Wnv6oShzsLM/2bCSLBg0s/k8TWi quDM2A4Py+U43iRzcRvBJge9zyFfYYY= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AED941357F; Mon, 23 Jan 2023 19:18:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +SQ7Ko3dzmNFVAAAMHmgww (envelope-from ); Mon, 23 Jan 2023 19:18:37 +0000 Date: Mon, 23 Jan 2023 20:18:37 +0100 From: Michal Hocko To: Matthew Wilcox Cc: Suren Baghdasaryan , "Liam R. Howlett" , akpm@linux-foundation.org, michel@lespinasse.org, jglisse@google.com, vbabka@suse.cz, hannes@cmpxchg.org, mgorman@techsingularity.net, dave@stgolabs.net, peterz@infradead.org, ldufour@linux.ibm.com, laurent.dufour@fr.ibm.com, paulmck@kernel.org, luto@kernel.org, songliubraving@fb.com, peterx@redhat.com, david@redhat.com, dhowells@redhat.com, hughd@google.com, bigeasy@linutronix.de, kent.overstreet@linux.dev, punit.agrawal@bytedance.com, lstoakes@gmail.com, peterjung1337@gmail.com, rientjes@google.com, axelrasmussen@google.com, joelaf@google.com, minchan@google.com, jannh@google.com, shakeelb@google.com, tatashin@google.com, edumazet@google.com, gthelen@google.com, gurua@google.com, arjunroy@google.com, soheil@google.com, hughlynch@google.com, leewalsh@google.com, posk@google.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH 39/41] kernel/fork: throttle call_rcu() calls in vm_area_free Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 8AA4C120002 X-Stat-Signature: eddzrusk3udxhe7b5cbcykcgntrpckdj X-HE-Tag: 1674501519-743335 X-HE-Meta: U2FsdGVkX1+rNQRhn6kUQVPh6q/PAT5INIPE6om1HpuRTfO52FW1fy46YsOPu1R8WZBvzDz6TSfXTdYipZqWfFrESIa6YfSryxoFItMg1gThc9Aw2ghuPRmYHCEgEg689Gmq/qL3TJJFi41VshYTpx2xVT8XsdhqtVYCCR0HBD7OW7rUThjXlmJHZlw4aopKPN4Z3OvQP4SVJ6RKnxwkVnoAKPDsdHaxWA+srdcz1ziHrc9a1uCycspVOFxteYTnItm+Ma0htG40YZQm/g/L72cyGnD0eO8cO1MfxhGvF/3i9QgGGCeTZ87THpcoTFCSMxKadL9O757VyuSWRSSU0XExxvxtbjRN5Oz3xpei539txKc9N5JLbN9FFQQUrATN0mdME+SeBiQKdQqQet6hbEyEkoPrJhj7ehz9lx6caGw8SCfsR/EdL9gp6niAF85HiZoG5nGL6qdE+I6iSDUU/g2jfHxNolbJ9YwXbm624pGA4Gs6zJhEsyYX/f4Lg+BpJjGIpt39/hnBk5dUYAz6VUR4wis3r0mjjzK9SwbjQJRaPzjKyQpKSpYWq6VoMdkOL3DyDG+/d/8zmytXwt6159mRdp9Oy4EuUdNXAmAxRsVOCWyqI+H/JD6Gk0/Jeq4unwPB6SKm2ioEkRzxnz9eUGev2qAMbk5X61jy2uVNnY2eJpH1uoV2cWvKej7z3NvDIHd3yCMvAppvZnEzOyqSCDqwllrl6WwTw7i1rt0uo5w4SHqJMrgpsJie3LyUgSHk38EdmgHjASB7Uyv1ikGMMY+QDLgQhL8t+/+Is7esnDjBiJ+vc15+ENDTNGul/f4HQ5CaYpCy6T87Gvdd3PVYgpsyaQbxhuSDwSCBWjDvCaDObcqUF2FaWymv4IHV5tFzncSQX4m4IT4/TGvjrySrDP0IJlICvcGTWXc9XQIcIbe1guSK3zcZAsFBEwyGAnQQ4y67xTaw/2GZF/Uk5N1 XwR95Wyz SLrlZvByc6eHLRNoHKbJ4g56zqsCYceCHMsfuiIHyWiJyGOiaEuDB5ppElzDNjSQ1UoEJVK4Wwix1X61LrqSNJhQoWT8ocW2GnQfsKsV32Lqgc8LOXSZqJ7p/EcGmWgCrl0OE0QM2q3QXXuYaW8Kt/9NvRWN/uhvhGlSpEjUSv83t1j3T1M2bi0X1J6titrCJN0npqqMe0UVm25tIWkrfMNJIYQ== 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 Mon 23-01-23 18:23:08, Matthew Wilcox wrote: > On Mon, Jan 23, 2023 at 09:46:20AM -0800, Suren Baghdasaryan wrote: [...] > > Yes, batching the vmas into a list and draining it in remove_mt() and > > exit_mmap() as you suggested makes sense to me and is quite simple. > > Let's do that if nobody has objections. > > I object. We *know* nobody has a reference to any of the VMAs because > you have to have a refcount on the mm before you can get a reference > to a VMA. If Michal is saying that somebody could do: > > mmget(mm); > vma = find_vma(mm); > lock_vma(vma); > mmput(mm); > vma->a = b; > unlock_vma(mm, vma); > > then that's something we'd catch in review -- you obviously can't use > the mm after you've dropped your reference to it. I am not claiming this is possible now. I do not think we want to have something like that in the future either but that is really hard to envision. I am claiming that it is subtle and potentially error prone to have two different ways of mass vma freeing wrt. locking. Also, don't we have a very similar situation during last munmaps? -- Michal Hocko SUSE Labs