mm: catch memory commitment underflow
[deliverable/linux.git] / mm / page_alloc.c
index ef44ad736ca17f79606021439b89a9fba4455564..c1c6cb78e5cae282d37fe69054698b633e98ccee 100644 (file)
@@ -1257,15 +1257,11 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
 void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp)
 {
        unsigned long flags;
-       int to_drain;
-       unsigned long batch;
+       int to_drain, batch;
 
        local_irq_save(flags);
        batch = ACCESS_ONCE(pcp->batch);
-       if (pcp->count >= batch)
-               to_drain = batch;
-       else
-               to_drain = pcp->count;
+       to_drain = min(pcp->count, batch);
        if (to_drain > 0) {
                free_pcppages_bulk(zone, to_drain, pcp);
                pcp->count -= to_drain;
@@ -2962,7 +2958,7 @@ EXPORT_SYMBOL(alloc_pages_exact);
  * Note this is not alloc_pages_exact_node() which allocates on a specific node,
  * but is not exact.
  */
-void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask)
+void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask)
 {
        unsigned order = get_order(size);
        struct page *p = alloc_pages_node(nid, gfp_mask, order);
@@ -2970,7 +2966,6 @@ void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask)
                return NULL;
        return make_alloc_exact((unsigned long)page_address(p), order, size);
 }
-EXPORT_SYMBOL(alloc_pages_exact_nid);
 
 /**
  * free_pages_exact - release memory allocated via alloc_pages_exact()
This page took 0.029402 seconds and 5 git commands to generate.