Re: [PATCH 4/9] mm/page_alloc: optimize code layout for __alloc_pages_bulk

2021-04-12 Thread Vlastimil Babka
On 3/25/21 12:42 PM, Mel Gorman wrote: > From: Jesper Dangaard Brouer > > Looking at perf-report and ASM-code for __alloc_pages_bulk() it is clear > that the code activated is suboptimal. The compiler guesses wrong and > places unlikely code at the beginning. Due to the use of WARN_ON_ONCE() >

Re: [PATCH 4/9] mm/page_alloc: optimize code layout for __alloc_pages_bulk

2021-03-25 Thread Mel Gorman
On Thu, Mar 25, 2021 at 12:12:17PM +, Matthew Wilcox wrote: > On Thu, Mar 25, 2021 at 11:42:23AM +, Mel Gorman wrote: > > > > - if (WARN_ON_ONCE(nr_pages <= 0)) > > + if (unlikely(nr_pages <= 0)) > > return 0; > > If we made nr_pages unsigned, we wouldn't need this check

Re: [PATCH 4/9] mm/page_alloc: optimize code layout for __alloc_pages_bulk

2021-03-25 Thread Matthew Wilcox
On Thu, Mar 25, 2021 at 11:42:23AM +, Mel Gorman wrote: > > - if (WARN_ON_ONCE(nr_pages <= 0)) > + if (unlikely(nr_pages <= 0)) > return 0; If we made nr_pages unsigned, we wouldn't need this check at all (ok, we'd still need to figure out what to do with 0). But