mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
mm, page_alloc: don't convert pfn to idx when merging
In __free_one_page() we do the buddy merging arithmetics on "page/buddy index", which is just the lower MAX_ORDER bits of pfn. The operations we do that affect the higher bits are bitwise AND and subtraction (in that order), where the final result will be the same with the higher bits left unmasked, as long as these bits are equal for both buddies - which must be true by the definition of a buddy. We can therefore use pfn's directly instead of "index" and skip the zeroing of >MAX_ORDER bits. This can help a bit by itself, although compiler might be smart enough already. It also helps the next patch to avoid page_to_pfn() for memory hole checks. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Vlastimil Babka <[email protected]> Acked-by: Mel Gorman <[email protected]> Cc: Joonsoo Kim <[email protected]> Cc: Michal Hocko <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: Johannes Weiner <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
aa187507ef
commit
76741e776a
3 changed files with 20 additions and 23 deletions
|
|
@ -133,9 +133,9 @@ struct alloc_context {
|
|||
* Assumption: *_mem_map is contiguous at least up to MAX_ORDER
|
||||
*/
|
||||
static inline unsigned long
|
||||
__find_buddy_index(unsigned long page_idx, unsigned int order)
|
||||
__find_buddy_pfn(unsigned long page_pfn, unsigned int order)
|
||||
{
|
||||
return page_idx ^ (1 << order);
|
||||
return page_pfn ^ (1 << order);
|
||||
}
|
||||
|
||||
extern struct page *__pageblock_pfn_to_page(unsigned long start_pfn,
|
||||
|
|
|
|||
Loading…
Reference in a new issue