summaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f265d37b3152..370b64d03e3f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2336,7 +2336,7 @@ retry:
2336 */ 2336 */
2337static int rmqueue_bulk(struct zone *zone, unsigned int order, 2337static int rmqueue_bulk(struct zone *zone, unsigned int order,
2338 unsigned long count, struct list_head *list, 2338 unsigned long count, struct list_head *list,
2339 int migratetype, bool cold) 2339 int migratetype)
2340{ 2340{
2341 int i, alloced = 0; 2341 int i, alloced = 0;
2342 2342
@@ -2358,10 +2358,7 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
2358 * merge IO requests if the physical pages are ordered 2358 * merge IO requests if the physical pages are ordered
2359 * properly. 2359 * properly.
2360 */ 2360 */
2361 if (likely(!cold)) 2361 list_add(&page->lru, list);
2362 list_add(&page->lru, list);
2363 else
2364 list_add_tail(&page->lru, list);
2365 list = &page->lru; 2362 list = &page->lru;
2366 alloced++; 2363 alloced++;
2367 if (is_migrate_cma(get_pcppage_migratetype(page))) 2364 if (is_migrate_cma(get_pcppage_migratetype(page)))
@@ -2795,7 +2792,7 @@ static inline void zone_statistics(struct zone *preferred_zone, struct zone *z)
2795 2792
2796/* Remove page from the per-cpu list, caller must protect the list */ 2793/* Remove page from the per-cpu list, caller must protect the list */
2797static struct page *__rmqueue_pcplist(struct zone *zone, int migratetype, 2794static struct page *__rmqueue_pcplist(struct zone *zone, int migratetype,
2798 bool cold, struct per_cpu_pages *pcp, 2795 struct per_cpu_pages *pcp,
2799 struct list_head *list) 2796 struct list_head *list)
2800{ 2797{
2801 struct page *page; 2798 struct page *page;
@@ -2804,16 +2801,12 @@ static struct page *__rmqueue_pcplist(struct zone *zone, int migratetype,
2804 if (list_empty(list)) { 2801 if (list_empty(list)) {
2805 pcp->count += rmqueue_bulk(zone, 0, 2802 pcp->count += rmqueue_bulk(zone, 0,
2806 pcp->batch, list, 2803 pcp->batch, list,
2807 migratetype, cold); 2804 migratetype);
2808 if (unlikely(list_empty(list))) 2805 if (unlikely(list_empty(list)))
2809 return NULL; 2806 return NULL;
2810 } 2807 }
2811 2808
2812 if (cold) 2809 page = list_first_entry(list, struct page, lru);
2813 page = list_last_entry(list, struct page, lru);
2814 else
2815 page = list_first_entry(list, struct page, lru);
2816
2817 list_del(&page->lru); 2810 list_del(&page->lru);
2818 pcp->count--; 2811 pcp->count--;
2819 } while (check_new_pcp(page)); 2812 } while (check_new_pcp(page));
@@ -2828,14 +2821,13 @@ static struct page *rmqueue_pcplist(struct zone *preferred_zone,
2828{ 2821{
2829 struct per_cpu_pages *pcp; 2822 struct per_cpu_pages *pcp;
2830 struct list_head *list; 2823 struct list_head *list;
2831 bool cold = ((gfp_flags & __GFP_COLD) != 0);
2832 struct page *page; 2824 struct page *page;
2833 unsigned long flags; 2825 unsigned long flags;
2834 2826
2835 local_irq_save(flags); 2827 local_irq_save(flags);
2836 pcp = &this_cpu_ptr(zone->pageset)->pcp; 2828 pcp = &this_cpu_ptr(zone->pageset)->pcp;
2837 list = &pcp->lists[migratetype]; 2829 list = &pcp->lists[migratetype];
2838 page = __rmqueue_pcplist(zone, migratetype, cold, pcp, list); 2830 page = __rmqueue_pcplist(zone, migratetype, pcp, list);
2839 if (page) { 2831 if (page) {
2840 __count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order); 2832 __count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order);
2841 zone_statistics(preferred_zone, zone); 2833 zone_statistics(preferred_zone, zone);