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 B0DC1C433EF for ; Fri, 21 Jan 2022 09:51:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3CD186B0087; Fri, 21 Jan 2022 04:51:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 356836B0092; Fri, 21 Jan 2022 04:51:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21E3B6B0093; Fri, 21 Jan 2022 04:51:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0249.hostedemail.com [216.40.44.249]) by kanga.kvack.org (Postfix) with ESMTP id 113BD6B0087 for ; Fri, 21 Jan 2022 04:51:41 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id BFA9E852FA for ; Fri, 21 Jan 2022 09:51:40 +0000 (UTC) X-FDA: 79053827160.13.970CEE9 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf31.hostedemail.com (Postfix) with ESMTP id 4625520004 for ; Fri, 21 Jan 2022 09:51:40 +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-out2.suse.de (Postfix) with ESMTPS id B88871F884; Fri, 21 Jan 2022 09:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1642758698; 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=W3TztOpgm9Ikx4CBHMNKVa/URwQROwDVM4fT1vsEWy4=; b=cv21lt9V0GrwOrelsUFMtw8ww5SpxhlR24oDMyT9nW+U4PfJcDriS6CYYG+SqSd30/9Bx1 DsFzF1Nt0yUOU2hThmwdy8tpZOLKpe9wN4oDF1o1pSF8JnXya6pwNjX36Cfywh0+b6bl6w IvwaZwBZ9QuNZQDlMmkw1F/B5XF3ApY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1642758698; 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=W3TztOpgm9Ikx4CBHMNKVa/URwQROwDVM4fT1vsEWy4=; b=qUaAkqA90fUI2q2AVp/A1EHSLwKU7zcbgSLuG880aUtdKe0NkHEdpF8xjIfnzGxXMpe5Ki vzlVpVoe6+W5SVBg== 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 762D913C32; Fri, 21 Jan 2022 09:51:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 5dzIGyqC6mENXQAAMHmgww (envelope-from ); Fri, 21 Jan 2022 09:51:38 +0000 Message-ID: Date: Fri, 21 Jan 2022 10:51:38 +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 66/66] mm/mmap: Drop range_has_overlap() function Content-Language: en-US To: Liam Howlett , "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton Cc: Song Liu , Davidlohr Bueso , "Paul E . McKenney" , Matthew Wilcox , 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-67-Liam.Howlett@oracle.com> From: Vlastimil Babka In-Reply-To: <20211201142918.921493-67-Liam.Howlett@oracle.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Stat-Signature: my535uhctd3jyepeiry5rgz8a3rk7b19 Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=cv21lt9V; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=qUaAkqA9; dmarc=none; spf=pass (imf31.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 4625520004 X-HE-Tag: 1642758700-119411 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 12/1/21 15:30, Liam Howlett wrote: > From: "Liam R. Howlett" > > Since there is no longer a linked list, the range_has_overlap() function > is identical to the find_vma_intersection() function. There is only one > place that actually needs the previous vma, so just use vma_prev() in > that one case. I guess that was written before some further changes and now it's removing just one user that doesn't care about pprev. > Signed-off-by: Liam R. Howlett Acked-by: Vlastimil Babka > --- > mm/mmap.c | 28 +--------------------------- > 1 file changed, 1 insertion(+), 27 deletions(-) > > diff --git a/mm/mmap.c b/mm/mmap.c > index e13c6ef76697..4dfe2f92796e 100644 > --- a/mm/mmap.c > +++ b/mm/mmap.c > @@ -420,30 +420,6 @@ anon_vma_interval_tree_post_update_vma(struct vm_area_struct *vma) > anon_vma_interval_tree_insert(avc, &avc->anon_vma->rb_root); > } > > -/* > - * range_has_overlap() - Check the @start - @end range for overlapping VMAs and > - * sets up a pointer to the previous VMA > - * @mm: the mm struct > - * @start: the start address of the range > - * @end: the end address of the range > - * @pprev: the pointer to the pointer of the previous VMA > - * > - * Returns: True if there is an overlapping VMA, false otherwise > - */ > -static inline > -bool range_has_overlap(struct mm_struct *mm, unsigned long start, > - unsigned long end, struct vm_area_struct **pprev) > -{ > - struct vm_area_struct *existing; > - > - MA_STATE(mas, &mm->mm_mt, start, start); > - rcu_read_lock(); > - existing = mas_find(&mas, end - 1); > - *pprev = mas_prev(&mas, 0); > - rcu_read_unlock(); > - return existing ? true : false; > -} > - > static unsigned long count_vma_pages_range(struct mm_struct *mm, > unsigned long addr, unsigned long end) > { > @@ -3188,9 +3164,7 @@ void exit_mmap(struct mm_struct *mm) > */ > int insert_vm_struct(struct mm_struct *mm, struct vm_area_struct *vma) > { > - struct vm_area_struct *prev; > - > - if (range_has_overlap(mm, vma->vm_start, vma->vm_end, &prev)) > + if (find_vma_intersection(mm, vma->vm_start, vma->vm_end)) > return -ENOMEM; > > if ((vma->vm_flags & VM_ACCOUNT) &&