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 11CDBC433EF for ; Thu, 20 Jan 2022 17:06:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4E0C36B0080; Thu, 20 Jan 2022 12:06:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4693C6B009C; Thu, 20 Jan 2022 12:06:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 330DA6B009D; Thu, 20 Jan 2022 12:06:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id 200346B0080 for ; Thu, 20 Jan 2022 12:06:28 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D6E8992DED for ; Thu, 20 Jan 2022 17:06:27 +0000 (UTC) X-FDA: 79051294014.18.E73A3ED Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf06.hostedemail.com (Postfix) with ESMTP id 294D9180006 for ; Thu, 20 Jan 2022 17:06:27 +0000 (UTC) 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-out1.suse.de (Postfix) with ESMTPS id A705F21923; Thu, 20 Jan 2022 17:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1642698385; h=from:from:reply-to: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; bh=cXz02UyD8cIbOQQZPbROB09tychDefhAh9aq7UM2Y7A=; b=EM7y7490Ebku75fSgL/AyiRihLakefHh0s8/9SF/gILgFDQYiUf5WJzZl3sUnqKtNs23kA w7O9oHwnHCrFYdPAhIvYLB7T8YYAFRbgkOYcna3jXG1sS3Ma+sdNi21Eh7MDYbVFMMxVDF KyvbjBDikiKyAPcJ21lK0MtMRDLRsCk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1642698385; h=from:from:reply-to: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; bh=cXz02UyD8cIbOQQZPbROB09tychDefhAh9aq7UM2Y7A=; b=8xS5qDSj7H5Tj8bs8AsZ7/rK9TyIAj0DqmSf7ysyom3C1Yyngixsf5aB9X66iVTz8MLy0S f2KM6/oypCnlWgAg== 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 5E7B513E8A; Thu, 20 Jan 2022 17:06:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 3lhEFpGW6WGSbAAAMHmgww (envelope-from ); Thu, 20 Jan 2022 17:06:25 +0000 Message-ID: <56968b52-8629-2751-6a95-3bffa84a2326@suse.cz> Date: Thu, 20 Jan 2022 18:06:25 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v4 64/66] nommu: Remove uses of VMA linked list Content-Language: en-US To: Matthew Wilcox Cc: Liam Howlett , "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton , Song Liu , Davidlohr Bueso , "Paul E . McKenney" , Laurent Dufour , David Rientjes , Axel Rasmussen , Suren Baghdasaryan , Rik van Riel , Peter Zijlstra , Michel Lespinasse , Jerome Glisse , Minchan Kim , Joel Fernandes , Rom Lemarchand References: <20211201142918.921493-1-Liam.Howlett@oracle.com> <20211201142918.921493-65-Liam.Howlett@oracle.com> <3709289f-fe78-3e7a-649a-a38fb1b3329e@suse.cz> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 294D9180006 X-Stat-Signature: 7dp7my7schhbugn5z6ro17qwmgyawfao Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=EM7y7490; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=8xS5qDSj; spf=pass (imf06.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Rspamd-Server: rspam07 X-HE-Tag: 1642698387-147573 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 1/20/22 16:54, Matthew Wilcox wrote: > On Thu, Jan 20, 2022 at 04:06:21PM +0100, Vlastimil Babka wrote: >> On 12/1/21 15:30, Liam Howlett wrote: >> > From: "Matthew Wilcox (Oracle)" >> > >> > Use the maple tree or VMA iterator instead. This is faster and will >> > allow us to shrink the VMA. >> > >> > Signed-off-by: Matthew Wilcox (Oracle) >> > Signed-off-by: Liam R. Howlett >> >> Acked-by: Vlastimil Babka >> >> But I think some fixup needed: >> >> > @@ -1456,12 +1458,14 @@ void exit_mmap(struct mm_struct *mm) >> > >> > mm->total_vm = 0; >> > >> > - while ((vma = mm->mmap)) { >> > - mm->mmap = vma->vm_next; >> > + mmap_write_lock(mm); >> >> If locking was missing, should have been added sooner than now? > > I don't think so? This is the exit_mmap() path, so we know nobody > has access to the mm. We didn't need to hold the lock at this point > before, but now for_each_vma() will check we're holding the mmap_lock. It has crossed my mind that it is there to make asserts happy, in which case a clarifying comment would be useful. >> > + for_each_vma(vmi, vma) { >> > delete_vma_from_mm(vma); >> > delete_vma(mm, vma); >> > cond_resched(); >> > } >> > + __mt_destroy(&mm->mm_mt); >> >> And this at the point mm_mt was added? > > You mean we should have been calling __mt_destroy() earlier in the > patch series? Yeah. > Umm ... I'll defer to Liam on that one.