From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: drm pull for v5.3-rc1 Date: Tue, 6 Aug 2019 23:40:00 -0700 Message-ID: <20190807064000.GC6002@infradead.org> References: <48890b55-afc5-ced8-5913-5a755ce6c1ab@shipmail.org> <20190806073831.GA26668@infradead.org> <20190806190937.GD30179@bombadil.infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190806190937.GD30179@bombadil.infradead.org> Sender: linux-kernel-owner@vger.kernel.org To: Matthew Wilcox Cc: Linus Torvalds , Christoph Hellwig , Thomas =?iso-8859-1?Q?Hellstr=F6m_=28VMware=29?= , Dave Airlie , Thomas Hellstrom , Daniel Vetter , LKML , dri-devel , Jerome Glisse , Jason Gunthorpe , Andrew Morton , Steven Price , Linux-MM List-Id: dri-devel@lists.freedesktop.org On Tue, Aug 06, 2019 at 12:09:38PM -0700, Matthew Wilcox wrote: > Has anyone looked at turning the interface inside-out? ie something like: > > struct mm_walk_state state = { .mm = mm, .start = start, .end = end, }; > > for_each_page_range(&state, page) { > ... do something with page ... > } > > with appropriate macrology along the lines of: > > #define for_each_page_range(state, page) \ > while ((page = page_range_walk_next(state))) > > Then you don't need to package anything up into structs that are shared > between the caller and the iterated function. I'm not an all that huge fan of super magic macro loops. But in this case I don't see how it could even work, as we get special callbacks for huge pages and holes, and people are trying to add a few more ops as well.