diff options
Diffstat (limited to 'mm/highmem.c')
-rw-r--r-- | mm/highmem.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/mm/highmem.c b/mm/highmem.c index 9b274fdf9d08..ee5519b176ee 100644 --- a/mm/highmem.c +++ b/mm/highmem.c | |||
@@ -46,6 +46,19 @@ static void *mempool_alloc_pages_isa(gfp_t gfp_mask, void *data) | |||
46 | */ | 46 | */ |
47 | #ifdef CONFIG_HIGHMEM | 47 | #ifdef CONFIG_HIGHMEM |
48 | 48 | ||
49 | unsigned long totalhigh_pages __read_mostly; | ||
50 | |||
51 | unsigned int nr_free_highpages (void) | ||
52 | { | ||
53 | pg_data_t *pgdat; | ||
54 | unsigned int pages = 0; | ||
55 | |||
56 | for_each_online_pgdat(pgdat) | ||
57 | pages += pgdat->node_zones[ZONE_HIGHMEM].free_pages; | ||
58 | |||
59 | return pages; | ||
60 | } | ||
61 | |||
49 | static int pkmap_count[LAST_PKMAP]; | 62 | static int pkmap_count[LAST_PKMAP]; |
50 | static unsigned int last_pkmap_nr; | 63 | static unsigned int last_pkmap_nr; |
51 | static __cacheline_aligned_in_smp DEFINE_SPINLOCK(kmap_lock); | 64 | static __cacheline_aligned_in_smp DEFINE_SPINLOCK(kmap_lock); |
@@ -315,8 +328,8 @@ static void bounce_end_io(struct bio *bio, mempool_t *pool, int err) | |||
315 | if (bvec->bv_page == org_vec->bv_page) | 328 | if (bvec->bv_page == org_vec->bv_page) |
316 | continue; | 329 | continue; |
317 | 330 | ||
318 | mempool_free(bvec->bv_page, pool); | 331 | dec_zone_page_state(bvec->bv_page, NR_BOUNCE); |
319 | dec_page_state(nr_bounce); | 332 | mempool_free(bvec->bv_page, pool); |
320 | } | 333 | } |
321 | 334 | ||
322 | bio_endio(bio_orig, bio_orig->bi_size, err); | 335 | bio_endio(bio_orig, bio_orig->bi_size, err); |
@@ -397,7 +410,7 @@ static void __blk_queue_bounce(request_queue_t *q, struct bio **bio_orig, | |||
397 | to->bv_page = mempool_alloc(pool, q->bounce_gfp); | 410 | to->bv_page = mempool_alloc(pool, q->bounce_gfp); |
398 | to->bv_len = from->bv_len; | 411 | to->bv_len = from->bv_len; |
399 | to->bv_offset = from->bv_offset; | 412 | to->bv_offset = from->bv_offset; |
400 | inc_page_state(nr_bounce); | 413 | inc_zone_page_state(to->bv_page, NR_BOUNCE); |
401 | 414 | ||
402 | if (rw == WRITE) { | 415 | if (rw == WRITE) { |
403 | char *vto, *vfrom; | 416 | char *vto, *vfrom; |