*参照元 [#kd956419] #backlinks *説明 [#ec3ebf68] -パス: [[linux-4.4.1/mm/page_alloc.c]] -FIXME: これは何? --説明 **引数 [#kb236a39] -struct page *page -- --[[linux-4.4.1/]] --[[linux-4.4.1/page]] -bool cold -- **返り値 [#ab610a56] -なし **参考 [#q0b9c027] *実装 [#n5344d54] /* * Free a 0-order page * cold == true ? free a cold page : free a hot page */ void free_hot_cold_page(struct page *page, bool cold) { struct zone *zone = page_zone(page); struct per_cpu_pages *pcp; unsigned long flags; unsigned long pfn = page_to_pfn(page); int migratetype; - --[[linux-4.4.1/zone]] --[[linux-4.4.1/page_zone()]] --[[linux-4.4.1/per_cpu_pages]] --[[linux-4.4.1/page_to_pfn()]] if (!free_pages_prepare(page, 0)) return; - --[[linux-4.4.1/free_pages_prepare()]] migratetype = get_pfnblock_migratetype(page, pfn); set_pcppage_migratetype(page, migratetype); local_irq_save(flags); __count_vm_event(PGFREE); - --[[linux-4.4.1/get_pnfblock_migratetype()]] --[[linux-4.4.1/set_pcppage_migratetype()]] --[[linux-4.4.1/local_irq_save()]] --[[linux-4.4.1/__count_vm_event()]] /* * We only track unmovable, reclaimable and movable on pcp lists. * Free ISOLATE pages back to the allocator because they are being * offlined but treat RESERVE as movable pages so we can get those * areas back if necessary. Otherwise, we may have to free * excessively into the page allocator */ if (migratetype >= MIGRATE_PCPTYPES) { if (unlikely(is_migrate_isolate(migratetype))) { free_one_page(zone, page, pfn, 0, migratetype); goto out; - --[[linux-4.4.1/MIGRATE_PCPTYPES]] --[[linux-4.4.1/unlikely()]] --[[linux-4.4.1/is_migrate_isolate()]] --[[linux-4.4.1/free_one_page()]] } migratetype = MIGRATE_MOVABLE; - --[[linux-4.4.1/MIGRATE_MOVABLE]] } pcp = &this_cpu_ptr(zone->pageset)->pcp; if (!cold) list_add(&page->lru, &pcp->lists[migratetype]); else list_add_tail(&page->lru, &pcp->lists[migratetype]); - --[[linux-4.4.1/this_cpu_ptr()]] --[[linux-4.4.1/list_add()]] --[[linux-4.4.1/list_add_tail()]] pcp->count++; if (pcp->count >= pcp->high) { unsigned long batch = READ_ONCE(pcp->batch); free_pcppages_bulk(zone, batch, pcp); pcp->count -= batch; } out: local_irq_restore(flags); } *コメント [#i782d9be]