On Thu, Apr 09, 2020 at 07:32:38AM -0700, Matthew Wilcox wrote: > On Thu, Apr 09, 2020 at 05:28:51PM +0300, Kirill A. Shutemov wrote: > > > We have a few places that do things like > > > > > > mm/filemap.c: if (unlikely(compound_head(page)->mapping != mapping)) { > > > > Good point. > > > > Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> > > Darn, I hoped you'd have a better idea. I feel quite ashamed of this patch. I had two ideas. Both awful. - Rename compound_head() to __compound_head() or something and make it return void *. Then wrap it into a macro that would cast return type to type of the argument. It would allow to regain *some* type safety. - Provide two implementations and use C11 _Generic() :P (bump GCC version requirements first) -- Kirill A. Shutemov