On Thu, 14 Mar 2019, Takashi Iwai wrote: > On Thu, 14 Mar 2019 14:29:33 +0100, > Michal Hocko wrote: > > > > On Thu 14-03-19 14:15:38, Takashi Iwai wrote: > > > On Thu, 14 Mar 2019 13:09:39 +0100, > > > Michal Hocko wrote: > > > > > > > > On Thu 14-03-19 12:56:43, Takashi Iwai wrote: > > > > > On Thu, 14 Mar 2019 12:36:26 +0100, > > > > > Michal Hocko wrote: > > > > > > > > > > > > On Thu 14-03-19 11:30:03, Vlastimil Babka wrote: > > [...] > > > > > > > I initially went with 2 as well, as you can see from v1 :) but then I looked at > > > > > > > the commit [2] mentioned in [1] and I think ALSA legitimaly uses __GFP_COMP so > > > > > > > that the pages are then mapped to userspace. Breaking that didn't seem good. > > > > > > > > > > > > It used the flag legitimately before because they were allocating > > > > > > compound pages but now they don't so this is just a conversion bug. > > > > > > > > > > We still use __GFP_COMP for allocation of the sound buffers that are > > > > > also mmapped to user-space. The mentioned commit above [2] was > > > > > reverted later. > > > > > > > > Yes, I understand that part. __GFP_COMP makes sense on a comound page. > > > > But if you are using alloc_pages_exact then the flag doesn't make sense > > > > because split out should already do what you want. Unless I am missing > > > > something. > > > > > > The __GFP_COMP was taken as a sort of workaround for the problem wrt > > > mmap I already forgot. If it can be eliminated, it's all good. > > > > Without __GFP_COMP you would get tail pages which are not setup properly > > AFAIU. With alloc_pages_exact you should get an "array" of head pages > > which are properly reference counted. But I might misunderstood the > > original problem which __GFP_COMP tried to solve. > > I only vaguely remember that it was about a Bad Page error for the > reserved pages, but forgot the all details, sorry. > > Hugh, could you confirm whether we still need __GFP_COMP in the sound > buffer allocations? FWIW, it's the change introduced by the ancient > commit f3d48f0373c1. I'm not confident in finding all "the sound buffer allocations". Where you're using alloc_pages_exact() for them, you do not need __GFP_COMP, and should not pass it. But if there are other places where you use one of those page allocators with an "order" argument non-zero, and map that buffer into userspace (without any split_page()), there you would still need the __GFP_COMP - zap_pte_range() and others do the wrong thing on tail ptes if the non-zero-order page has neither been set up as compound nor split into zero-order pages. Hugh