• Home
  • Raw
  • Download

Lines Matching full:bm

547 static void memory_bm_position_reset(struct memory_bitmap *bm)  in memory_bm_position_reset()  argument
549 bm->cur.zone = list_entry(bm->zones.next, struct mem_zone_bm_rtree, in memory_bm_position_reset()
551 bm->cur.node = list_entry(bm->cur.zone->leaves.next, in memory_bm_position_reset()
553 bm->cur.node_pfn = 0; in memory_bm_position_reset()
554 bm->cur.node_bit = 0; in memory_bm_position_reset()
557 static void memory_bm_free(struct memory_bitmap *bm, int clear_nosave_free);
642 static int memory_bm_create(struct memory_bitmap *bm, gfp_t gfp_mask, in memory_bm_create() argument
651 INIT_LIST_HEAD(&bm->zones); in memory_bm_create()
666 list_add_tail(&zone->list, &bm->zones); in memory_bm_create()
669 bm->p_list = ca.chain; in memory_bm_create()
670 memory_bm_position_reset(bm); in memory_bm_create()
676 bm->p_list = ca.chain; in memory_bm_create()
677 memory_bm_free(bm, PG_UNSAFE_CLEAR); in memory_bm_create()
683 * @bm: Memory bitmap.
685 static void memory_bm_free(struct memory_bitmap *bm, int clear_nosave_free) in memory_bm_free() argument
689 list_for_each_entry(zone, &bm->zones, list) in memory_bm_free()
692 free_list_of_pages(bm->p_list, clear_nosave_free); in memory_bm_free()
694 INIT_LIST_HEAD(&bm->zones); in memory_bm_free()
700 * Find the bit in memory bitmap @bm that corresponds to the given PFN.
701 * The cur.zone, cur.block and cur.node_pfn members of @bm are updated.
706 static int memory_bm_find_bit(struct memory_bitmap *bm, unsigned long pfn, in memory_bm_find_bit() argument
713 zone = bm->cur.zone; in memory_bm_find_bit()
721 list_for_each_entry(curr, &bm->zones, list) { in memory_bm_find_bit()
742 node = bm->cur.node; in memory_bm_find_bit()
743 if (zone == bm->cur.zone && in memory_bm_find_bit()
744 ((pfn - zone->start_pfn) & ~BM_BLOCK_MASK) == bm->cur.node_pfn) in memory_bm_find_bit()
761 bm->cur.zone = zone; in memory_bm_find_bit()
762 bm->cur.node = node; in memory_bm_find_bit()
763 bm->cur.node_pfn = (pfn - zone->start_pfn) & ~BM_BLOCK_MASK; in memory_bm_find_bit()
772 static void memory_bm_set_bit(struct memory_bitmap *bm, unsigned long pfn) in memory_bm_set_bit() argument
778 error = memory_bm_find_bit(bm, pfn, &addr, &bit); in memory_bm_set_bit()
783 static int mem_bm_set_bit_check(struct memory_bitmap *bm, unsigned long pfn) in mem_bm_set_bit_check() argument
789 error = memory_bm_find_bit(bm, pfn, &addr, &bit); in mem_bm_set_bit_check()
796 static void memory_bm_clear_bit(struct memory_bitmap *bm, unsigned long pfn) in memory_bm_clear_bit() argument
802 error = memory_bm_find_bit(bm, pfn, &addr, &bit); in memory_bm_clear_bit()
807 static void memory_bm_clear_current(struct memory_bitmap *bm) in memory_bm_clear_current() argument
811 bit = max(bm->cur.node_bit - 1, 0); in memory_bm_clear_current()
812 clear_bit(bit, bm->cur.node->data); in memory_bm_clear_current()
815 static int memory_bm_test_bit(struct memory_bitmap *bm, unsigned long pfn) in memory_bm_test_bit() argument
821 error = memory_bm_find_bit(bm, pfn, &addr, &bit); in memory_bm_test_bit()
826 static bool memory_bm_pfn_present(struct memory_bitmap *bm, unsigned long pfn) in memory_bm_pfn_present() argument
831 return !memory_bm_find_bit(bm, pfn, &addr, &bit); in memory_bm_pfn_present()
844 static bool rtree_next_node(struct memory_bitmap *bm) in rtree_next_node() argument
846 if (!list_is_last(&bm->cur.node->list, &bm->cur.zone->leaves)) { in rtree_next_node()
847 bm->cur.node = list_entry(bm->cur.node->list.next, in rtree_next_node()
849 bm->cur.node_pfn += BM_BITS_PER_BLOCK; in rtree_next_node()
850 bm->cur.node_bit = 0; in rtree_next_node()
856 if (!list_is_last(&bm->cur.zone->list, &bm->zones)) { in rtree_next_node()
857 bm->cur.zone = list_entry(bm->cur.zone->list.next, in rtree_next_node()
859 bm->cur.node = list_entry(bm->cur.zone->leaves.next, in rtree_next_node()
861 bm->cur.node_pfn = 0; in rtree_next_node()
862 bm->cur.node_bit = 0; in rtree_next_node()
872 * @bm: Memory bitmap.
875 * set bit in @bm and returns the PFN represented by it. If no more bits are
881 static unsigned long memory_bm_next_pfn(struct memory_bitmap *bm) in memory_bm_next_pfn() argument
887 pages = bm->cur.zone->end_pfn - bm->cur.zone->start_pfn; in memory_bm_next_pfn()
888 bits = min(pages - bm->cur.node_pfn, BM_BITS_PER_BLOCK); in memory_bm_next_pfn()
889 bit = find_next_bit(bm->cur.node->data, bits, in memory_bm_next_pfn()
890 bm->cur.node_bit); in memory_bm_next_pfn()
892 pfn = bm->cur.zone->start_pfn + bm->cur.node_pfn + bit; in memory_bm_next_pfn()
893 bm->cur.node_bit = bit + 1; in memory_bm_next_pfn()
896 } while (rtree_next_node(bm)); in memory_bm_next_pfn()
924 static void memory_bm_recycle(struct memory_bitmap *bm) in memory_bm_recycle() argument
929 list_for_each_entry(zone, &bm->zones, list) in memory_bm_recycle()
932 p_list = bm->p_list; in memory_bm_recycle()
1030 * @bm: Memory bitmap.
1032 * Set the bits in @bm that correspond to the page frames the contents of which
1035 static void mark_nosave_pages(struct memory_bitmap *bm) in mark_nosave_pages() argument
1058 mem_bm_set_bit_check(bm, pfn); in mark_nosave_pages()
1142 struct memory_bitmap *bm = free_pages_map; in clear_free_pages() local
1149 memory_bm_position_reset(bm); in clear_free_pages()
1150 pfn = memory_bm_next_pfn(bm); in clear_free_pages()
1155 pfn = memory_bm_next_pfn(bm); in clear_free_pages()
1157 memory_bm_position_reset(bm); in clear_free_pages()
1903 static inline unsigned int alloc_highmem_pages(struct memory_bitmap *bm, in alloc_highmem_pages() argument
1916 memory_bm_set_bit(bm, page_to_pfn(page)); in alloc_highmem_pages()
1923 static inline unsigned int alloc_highmem_pages(struct memory_bitmap *bm, in alloc_highmem_pages() argument
2053 * @bm: Memory bitmap.
2056 * PFNs corresponding to set bits in @bm are stored in the area of memory
2059 static inline void pack_pfns(unsigned long *buf, struct memory_bitmap *bm) in pack_pfns() argument
2064 buf[j] = memory_bm_next_pfn(bm); in pack_pfns()
2152 static void mark_unsafe_pages(struct memory_bitmap *bm) in mark_unsafe_pages() argument
2165 duplicate_memory_bitmap(free_pages_map, bm); in mark_unsafe_pages()
2202 * @bm: Memory bitmap.
2206 * corresponding bit in @bm.
2208 static int unpack_orig_pfns(unsigned long *buf, struct memory_bitmap *bm) in unpack_orig_pfns() argument
2216 if (pfn_valid(buf[j]) && memory_bm_pfn_present(bm, buf[j])) in unpack_orig_pfns()
2217 memory_bm_set_bit(bm, buf[j]); in unpack_orig_pfns()
2247 * @bm: Memory bitmap.
2249 * The bits in @bm that correspond to image pages are assumed to be set.
2251 static unsigned int count_highmem_image_pages(struct memory_bitmap *bm) in count_highmem_image_pages() argument
2256 memory_bm_position_reset(bm); in count_highmem_image_pages()
2257 pfn = memory_bm_next_pfn(bm); in count_highmem_image_pages()
2262 pfn = memory_bm_next_pfn(bm); in count_highmem_image_pages()
2273 * @bm: Pointer to an uninitialized memory bitmap structure.
2280 * @bm (it must be unitialized).
2284 static int prepare_highmem_image(struct memory_bitmap *bm, in prepare_highmem_image() argument
2289 if (memory_bm_create(bm, GFP_ATOMIC, PG_SAFE)) in prepare_highmem_image()
2308 memory_bm_set_bit(bm, page_to_pfn(page)); in prepare_highmem_image()
2315 memory_bm_position_reset(bm); in prepare_highmem_image()
2316 safe_highmem_bm = bm; in prepare_highmem_image()
2418 static unsigned int count_highmem_image_pages(struct memory_bitmap *bm) { return 0; } in count_highmem_image_pages() argument
2420 static inline int prepare_highmem_image(struct memory_bitmap *bm, in prepare_highmem_image() argument
2439 * @bm: Memory bitmap with unsafe pages marked.
2441 * Use @bm to mark the pages that will be overwritten in the process of
2451 static int prepare_image(struct memory_bitmap *new_bm, struct memory_bitmap *bm) in prepare_image() argument
2461 nr_highmem = count_highmem_image_pages(bm); in prepare_image()
2462 mark_unsafe_pages(bm); in prepare_image()
2468 duplicate_memory_bitmap(new_bm, bm); in prepare_image()
2469 memory_bm_free(bm, PG_UNSAFE_KEEP); in prepare_image()
2471 error = prepare_highmem_image(bm, &nr_highmem); in prepare_image()
2527 static void *get_buffer(struct memory_bitmap *bm, struct chain_allocator *ca) in get_buffer() argument
2531 unsigned long pfn = memory_bm_next_pfn(bm); in get_buffer()