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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44690C433EF for ; Thu, 9 Dec 2021 15:26:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239488AbhLIPaJ (ORCPT ); Thu, 9 Dec 2021 10:30:09 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:57434 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236184AbhLIPaI (ORCPT ); Thu, 9 Dec 2021 10:30:08 -0500 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 44084210FD; Thu, 9 Dec 2021 15:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1639063594; 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=/VlSP1skdj+sAAa5O9Ry2NezQRyqLlQFjUyMBZbONA0=; b=o81hRcfHyTPjWYhYrrYl39hEtO7vz40SrOg6M2DWfm/3/p7kYLZ8afVguWly9X3Mjx+LHI dklamRhRCA3WdWzEGVnMHILZAlZVz+qc0YCXNt80hEFA5F3THEL6R5pXQfs1VUU+dOIZCD dkXKY3N3ZSdVjtFddYxrR1u4hOyC2zk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1639063594; 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=/VlSP1skdj+sAAa5O9Ry2NezQRyqLlQFjUyMBZbONA0=; b=+wWyReEM6eATLVcSJaIsJUBCuXRaDlHOfS0UoHG+6bidiqgJibZ3/mD2Eiv4KalVhvBEH2 EerisIuoCh62ZVBQ== 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 E7CFC13343; Thu, 9 Dec 2021 15:26:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id J5fONykgsmEZRAAAMHmgww (envelope-from ); Thu, 09 Dec 2021 15:26:33 +0000 Message-ID: Date: Thu, 9 Dec 2021 16:26:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v4 07/66] mm: Add VMA iterator 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-8-Liam.Howlett@oracle.com> From: Vlastimil Babka In-Reply-To: <20211201142918.921493-8-Liam.Howlett@oracle.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/1/21 15:29, Liam Howlett wrote: > From: "Matthew Wilcox (Oracle)" > > This thin layer of abstraction over the maple tree state is for > iterating over VMAs. You can go forwards, go backwards or ask where > the iterator is. Rename the existing vma_next() to __vma_next() -- > it will be removed by the end of this series. > > Signed-off-by: Matthew Wilcox (Oracle) > Signed-off-by: Liam R. Howlett Acked-by: Vlastimil Babka With a question below. > --- > include/linux/mm.h | 27 +++++++++++++++++++++++++++ > include/linux/mm_types.h | 21 +++++++++++++++++++++ > mm/mmap.c | 10 +++++----- > 3 files changed, 53 insertions(+), 5 deletions(-) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 9eae78a155be..acdccbe9b96b 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -696,6 +696,33 @@ static inline bool vma_is_accessible(struct vm_area_struct *vma) > return vma->vm_flags & VM_ACCESS_FLAGS; > } > > +static inline > +struct vm_area_struct *vma_find(struct vma_iterator *vmi, unsigned long max) > +{ > + return mas_find(&vmi->mas, max); > +} > + > +static inline struct vm_area_struct *vma_next(struct vma_iterator *vmi) > +{ > + return vma_find(vmi, ULONG_MAX); Why not mas_next()? > +} > + > +static inline struct vm_area_struct *vma_prev(struct vma_iterator *vmi) > +{ > + return mas_prev(&vmi->mas, 0); > +} > + > +static inline unsigned long vma_iter_addr(struct vma_iterator *vmi) > +{ > + return vmi->mas.index; > +} > + > +#define for_each_vma(vmi, vma) while ((vma = vma_next(&vmi)) != NULL) > +