本文整理汇总了C++中PageActive函数的典型用法代码示例。如果您正苦于以下问题:C++ PageActive函数的具体用法?C++ PageActive怎么用?C++ PageActive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PageActive函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: activate_page
/*
* FIXME: speed this up?
*/
void activate_page(struct page *page)
{
struct zone *zone = page_zone(page);
spin_lock_irq(&zone->lru_lock);
if (PageLRU(page) && !PageActive(page)) {
del_page_from_inactive_list(zone, page);
SetPageActive(page);
add_page_to_active_list(zone, page);
__count_vm_event(PGACTIVATE);
mem_cgroup_move_lists(page, true);
}
spin_unlock_irq(&zone->lru_lock);
}
开发者ID:274914765,项目名称:C,代码行数:17,代码来源:swap.c
示例2: __pagevec_lru_add_fn
static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec,
void *arg)
{
int file = page_is_file_cache(page);
int active = PageActive(page);
enum lru_list lru = page_lru(page);
VM_BUG_ON(PageLRU(page));
SetPageLRU(page);
add_page_to_lru_list(page, lruvec, lru);
update_page_reclaim_stat(lruvec, file, active);
trace_mm_lru_insertion(page, page_to_pfn(page), lru, trace_pagemap_flags(page));
}
开发者ID:jiaming77,项目名称:DORIMANX_LG_STOCK_LP_KERNEL,代码行数:14,代码来源:swap.c
示例3: pagevec_move_tail_fn
static void pagevec_move_tail_fn(struct page *page, void *arg)
{
int *pgmoved = arg;
if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
enum lru_list lru = page_lru_base_type(page);
struct lruvec *lruvec;
lruvec = mem_cgroup_lru_move_lists(page_zone(page),
page, lru, lru);
list_move_tail(&page->lru, &lruvec->lists[lru]);
(*pgmoved)++;
}
}
开发者ID:EddyKuo,项目名称:linux-sdk-kernel-source,代码行数:14,代码来源:swap.c
示例4: rotate_reclaimable_page
/*
* Writeback is about to end against a page which has been marked for immediate
* reclaim. If it still appears to be reclaimable, move it to the tail of the
* inactive list.
*/
void rotate_reclaimable_page(struct page *page)
{
if (!PageLocked(page) && !PageDirty(page) && !PageActive(page) &&
!PageUnevictable(page) && PageLRU(page)) {
struct pagevec *pvec;
unsigned long flags;
get_page(page);
local_irq_save(flags);
pvec = this_cpu_ptr(&lru_rotate_pvecs);
if (!pagevec_add(pvec, page) || PageCompound(page))
pagevec_move_tail(pvec);
local_irq_restore(flags);
}
}
开发者ID:forgivemyheart,项目名称:linux,代码行数:20,代码来源:swap.c
示例5: lru_add_page_tail
/* used by __split_huge_page_refcount() */
void lru_add_page_tail(struct page *page, struct page *page_tail,
struct lruvec *lruvec)
{
int uninitialized_var(active);
enum lru_list lru;
const int file = 0;
VM_BUG_ON(!PageHead(page));
VM_BUG_ON(PageCompound(page_tail));
VM_BUG_ON(PageLRU(page_tail));
VM_BUG_ON(NR_CPUS != 1 &&
!spin_is_locked(&lruvec_zone(lruvec)->lru_lock));
SetPageLRU(page_tail);
if (page_evictable(page_tail, NULL)) {
if (PageActive(page)) {
SetPageActive(page_tail);
active = 1;
lru = LRU_ACTIVE_ANON;
} else {
active = 0;
lru = LRU_INACTIVE_ANON;
}
} else {
SetPageUnevictable(page_tail);
lru = LRU_UNEVICTABLE;
}
if (likely(PageLRU(page)))
list_add_tail(&page_tail->lru, &page->lru);
else {
struct list_head *list_head;
/*
* Head page has not yet been counted, as an hpage,
* so we must account for each subpage individually.
*
* Use the standard add function to put page_tail on the list,
* but then correct its position so they all end up in order.
*/
add_page_to_lru_list(page_tail, lruvec, lru);
list_head = page_tail->lru.prev;
list_move_tail(&page_tail->lru, list_head);
}
if (!PageUnevictable(page))
update_page_reclaim_stat(lruvec, file, active);
}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:49,代码来源:swap.c
示例6: refill_inactive_scan
// refill_inactive_scan - try to move page in swap_active_list into swap_inactive_list
void
refill_inactive_scan(void) {
size_t maxscan = nr_active_pages;
list_entry_t *list = &(active_list.swap_list), *le = list_next(list);
while (maxscan -- > 0 && le != list) {
struct Page *page = le2page(le, swap_link);
le = list_next(le);
if (!(PageSwap(page) && PageActive(page))) {
panic("active: wrong swap list.\n");
}
if (page_ref(page) == 0) {
swap_list_del(page);
swap_inactive_list_add(page);
}
}
}
开发者ID:chyyuu,项目名称:ucore-arch-arm,代码行数:17,代码来源:swap.c
示例7: __activate_page
static void __activate_page(struct page *page, struct lruvec *lruvec,
void *arg)
{
if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
int file = page_is_file_cache(page);
int lru = page_lru_base_type(page);
del_page_from_lru_list(page, lruvec, lru);
SetPageActive(page);
lru += LRU_ACTIVE;
add_page_to_lru_list(page, lruvec, lru);
__count_vm_event(PGACTIVATE);
update_page_reclaim_stat(lruvec, file, 1);
}
}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:16,代码来源:swap.c
示例8: lru_deactivate_fn
static void lru_deactivate_fn(struct page *page, struct lruvec *lruvec,
void *arg)
{
if (PageLRU(page) && PageActive(page) && !PageUnevictable(page)) {
int file = page_is_file_cache(page);
int lru = page_lru_base_type(page);
del_page_from_lru_list(page, lruvec, lru + LRU_ACTIVE);
ClearPageActive(page);
ClearPageReferenced(page);
add_page_to_lru_list(page, lruvec, lru);
__count_vm_event(PGDEACTIVATE);
update_page_reclaim_stat(lruvec, file, 0);
}
}
开发者ID:forgivemyheart,项目名称:linux,代码行数:16,代码来源:swap.c
示例9: lru_deactivate_fn
/*
* If the page can not be invalidated, it is moved to the
* inactive list to speed up its reclaim. It is moved to the
* head of the list, rather than the tail, to give the flusher
* threads some time to write it out, as this is much more
* effective than the single-page writeout from reclaim.
*
* If the page isn't page_mapped and dirty/writeback, the page
* could reclaim asap using PG_reclaim.
*
* 1. active, mapped page -> none
* 2. active, dirty/writeback page -> inactive, head, PG_reclaim
* 3. inactive, mapped page -> none
* 4. inactive, dirty/writeback page -> inactive, head, PG_reclaim
* 5. inactive, clean -> inactive, tail
* 6. Others -> none
*
* In 4, why it moves inactive's head, the VM expects the page would
* be write it out by flusher threads as this is much more effective
* than the single-page writeout from reclaim.
*/
static void lru_deactivate_fn(struct page *page, void *arg)
{
int lru, file;
bool active;
struct zone *zone = page_zone(page);
if (!PageLRU(page))
return;
if (PageUnevictable(page))
return;
/* Some processes are using the page */
if (page_mapped(page))
return;
active = PageActive(page);
file = page_is_file_cache(page);
lru = page_lru_base_type(page);
del_page_from_lru_list(zone, page, lru + active);
ClearPageActive(page);
ClearPageReferenced(page);
add_page_to_lru_list(zone, page, lru);
if (PageWriteback(page) || PageDirty(page)) {
/*
* PG_reclaim could be raced with end_page_writeback
* It can make readahead confusing. But race window
* is _really_ small and it's non-critical problem.
*/
SetPageReclaim(page);
} else {
struct lruvec *lruvec;
/*
* The page's writeback ends up during pagevec
* We moves tha page into tail of inactive.
*/
lruvec = mem_cgroup_lru_move_lists(zone, page, lru, lru);
list_move_tail(&page->lru, &lruvec->lists[lru]);
__count_vm_event(PGROTATED);
}
if (active)
__count_vm_event(PGDEACTIVATE);
update_page_reclaim_stat(zone, page, file, 0);
}
开发者ID:EddyKuo,项目名称:linux-sdk-kernel-source,代码行数:68,代码来源:swap.c
示例10: __pagevec_lru_add_fn
static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec,
void *arg)
{
enum lru_list lru = (enum lru_list)arg;
int file = is_file_lru(lru);
int active = is_active_lru(lru);
VM_BUG_ON(PageActive(page));
VM_BUG_ON(PageUnevictable(page));
VM_BUG_ON(PageLRU(page));
SetPageLRU(page);
if (active)
SetPageActive(page);
add_page_to_lru_list(page, lruvec, lru);
update_page_reclaim_stat(lruvec, file, active);
}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:17,代码来源:swap.c
示例11: add_page_to_lru_list_cma
/*
* added by qijiwen.
* put the page on the lru directly
*/
void add_page_to_lru_list_cma(struct page *page, enum lru_list lru)
{
struct zone *zone = page_zone(page);
int file = is_file_lru(lru);
int active = is_active_lru(lru);
unsigned long flags = 0;
VM_BUG_ON(PageActive(page));
VM_BUG_ON(PageUnevictable(page));
VM_BUG_ON(PageLRU(page));
spin_lock_irqsave(&zone->lru_lock, flags);
SetPageLRU(page);
if (active)
SetPageActive(page);
update_page_reclaim_stat(zone, page, file, active);
add_page_to_lru_list(zone, page, lru);
spin_unlock_irqrestore(&zone->lru_lock, flags);
}
开发者ID:printusrzero,项目名称:hwp6s-kernel,代码行数:23,代码来源:swap.c
示例12: activate_page
/*
* FIXME: speed this up?
*/
void activate_page(struct page *page)
{
struct zone *zone = page_zone(page);
spin_lock_irq(&zone->lru_lock);
if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
int file = page_is_file_cache(page);
int lru = LRU_BASE + file;
del_page_from_lru_list(zone, page, lru);
SetPageActive(page);
lru += LRU_ACTIVE;
add_page_to_lru_list(zone, page, lru);
__count_vm_event(PGACTIVATE);
mem_cgroup_move_lists(page, lru);
zone->recent_rotated[!!file]++;
zone->recent_scanned[!!file]++;
}
spin_unlock_irq(&zone->lru_lock);
}
开发者ID:kizukukoto,项目名称:WDN900_GPL,代码行数:24,代码来源:swap.c
示例13: isolate_lru_page
/*
* Isolate one page from the LRU lists. If successful put it onto
* the indicated list with elevated page count.
*
* Result:
* -EBUSY: page not on LRU list
* 0: page removed from LRU list and added to the specified list.
*/
int isolate_lru_page(struct page *page, struct list_head *pagelist)
{
int ret = -EBUSY;
if (PageLRU(page)) {
struct zone *zone = page_zone(page);
spin_lock_irq(&zone->lru_lock);
if (PageLRU(page) && get_page_unless_zero(page)) {
ret = 0;
ClearPageLRU(page);
if (PageActive(page))
del_page_from_active_list(zone, page);
else
del_page_from_inactive_list(zone, page);
list_add_tail(&page->lru, pagelist);
}
spin_unlock_irq(&zone->lru_lock);
}
return ret;
}
开发者ID:khenam,项目名称:ardrone-kernel,代码行数:29,代码来源:migrate.c
示例14: rmqueue
static struct page * rmqueue(zone_t *zone, unsigned int order)
{
free_area_t * area = zone->free_area + order;
unsigned int curr_order = order;
struct list_head *head, *curr;
unsigned long flags;
struct page *page;
spin_lock_irqsave(&zone->lock, flags);
do {
head = &area->free_list;
curr = head->next;
if (curr != head) {
unsigned int index;
page = list_entry(curr, struct page, list);
if (BAD_RANGE(zone,page))
BUG();
list_del(curr);
index = page - zone->zone_mem_map;
if (curr_order != MAX_ORDER-1)
MARK_USED(index, curr_order, area);
zone->free_pages -= 1UL << order;
page = expand(zone, page, index, order, curr_order, area);
spin_unlock_irqrestore(&zone->lock, flags);
set_page_count(page, 1);
if (BAD_RANGE(zone,page))
BUG();
if (PageLRU(page))
BUG();
if (PageActive(page))
BUG();
return page;
}
curr_order++;
area++;
} while (curr_order < MAX_ORDER);
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:40,代码来源:page_alloc.c
示例15: page_launder
// page_launder - try to move page to swap_active_list OR swap_inactive_list,
// - and call swap_fs_write to swap out pages in swap_inactive_list
int
page_launder(void) {
size_t maxscan = nr_inactive_pages, free_count = 0;
list_entry_t *list = &(inactive_list.swap_list), *le = list_next(list);
while (maxscan -- > 0 && le != list) {
struct Page *page = le2page(le, swap_link);
le = list_next(le);
if (!(PageSwap(page) && !PageActive(page))) {
panic("inactive: wrong swap list.\n");
}
swap_list_del(page);
if (page_ref(page) != 0) {
swap_active_list_add(page);
continue ;
}
swap_entry_t entry = page->index;
if (!try_free_swap_entry(entry)) {
if (PageDirty(page)) {
ClearPageDirty(page);
swap_duplicate(entry);
if (swapfs_write(entry, page) != 0) {
SetPageDirty(page);
}
mem_map[swap_offset(entry)] --;
if (page_ref(page) != 0) {
swap_active_list_add(page);
continue ;
}
if (PageDirty(page)) {
swap_inactive_list_add(page);
continue ;
}
try_free_swap_entry(entry);
}
}
free_count ++;
swap_free_page(page);
}
return free_count;
}
开发者ID:chyyuu,项目名称:ucore-arch-arm,代码行数:42,代码来源:swap.c
示例16: lru_lazyfree_fn
static void lru_lazyfree_fn(struct page *page, struct lruvec *lruvec,
void *arg)
{
if (PageLRU(page) && PageAnon(page) && PageSwapBacked(page) &&
!PageSwapCache(page) && !PageUnevictable(page)) {
bool active = PageActive(page);
del_page_from_lru_list(page, lruvec,
LRU_INACTIVE_ANON + active);
ClearPageActive(page);
ClearPageReferenced(page);
/*
* lazyfree pages are clean anonymous pages. They have
* SwapBacked flag cleared to distinguish normal anonymous
* pages
*/
ClearPageSwapBacked(page);
add_page_to_lru_list(page, lruvec, LRU_INACTIVE_FILE);
__count_vm_events(PGLAZYFREE, hpage_nr_pages(page));
count_memcg_page_event(page, PGLAZYFREE);
update_page_reclaim_stat(lruvec, 1, 0);
}
}
开发者ID:Lyude,项目名称:linux,代码行数:24,代码来源:swap.c
示例17: ____pagevec_lru_add
/**
* ____pagevec_lru_add:将pvec缓存的页加入到zone的lru类型的LRU链表中去
* @ prev:页临时缓存
* @ lru: 页加入到区中LRU链表的类型
*/
void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru)
{
int i;
struct zone *zone = NULL;
VM_BUG_ON(is_unevictable_lru(lru));
for (i = 0; i < pagevec_count(pvec); i++) {
struct page *page = pvec->pages[i];
struct zone *pagezone = page_zone(page);
int file;
int active;
if (pagezone != zone) {
if (zone)
spin_unlock_irq(&zone->lru_lock);
zone = pagezone;
spin_lock_irq(&zone->lru_lock);
}
/*页框的属性不能是ACTIVE LRU UNEVICT*/
VM_BUG_ON(PageActive(page));
VM_BUG_ON(PageUnevictable(page));
VM_BUG_ON(PageLRU(page));
SetPageLRU(page);
active = is_active_lru(lru);
file = is_file_lru(lru);
if (active)
SetPageActive(page);
update_page_reclaim_stat(zone, page, file, active);
add_page_to_lru_list(zone, page, lru);
}
if (zone)
spin_unlock_irq(&zone->lru_lock);
release_pages(pvec->pages, pvec->nr, pvec->cold);
pagevec_reinit(pvec);
}
开发者ID:yl849646685,项目名称:linux-2.6.32,代码行数:41,代码来源:swap.c
示例18: check_swap
// check_swap - check the correctness of swap & page replacement algorithm
static void
check_swap(void) {
size_t nr_used_pages_store = nr_used_pages();
size_t slab_allocated_store = slab_allocated();
size_t offset;
for (offset = 2; offset < max_swap_offset; offset ++) {
mem_map[offset] = 1;
}
struct mm_struct *mm = mm_create();
assert(mm != NULL);
extern struct mm_struct *check_mm_struct;
assert(check_mm_struct == NULL);
check_mm_struct = mm;
pgd_t *pgdir = mm->pgdir = init_pgdir_get();
assert(pgdir[PGX(TEST_PAGE)] == 0);
struct vma_struct *vma = vma_create(TEST_PAGE, TEST_PAGE + PTSIZE, VM_WRITE | VM_READ);
assert(vma != NULL);
insert_vma_struct(mm, vma);
struct Page *rp0 = alloc_page(), *rp1 = alloc_page();
assert(rp0 != NULL && rp1 != NULL);
pte_perm_t perm;
ptep_unmap (&perm);
ptep_set_u_write(&perm);
int ret = page_insert(pgdir, rp1, TEST_PAGE, perm);
assert(ret == 0 && page_ref(rp1) == 1);
page_ref_inc(rp1);
ret = page_insert(pgdir, rp0, TEST_PAGE, perm);
assert(ret == 0 && page_ref(rp1) == 1 && page_ref(rp0) == 1);
// check try_alloc_swap_entry
swap_entry_t entry = try_alloc_swap_entry();
assert(swap_offset(entry) == 1);
mem_map[1] = 1;
assert(try_alloc_swap_entry() == 0);
// set rp1, Swap, Active, add to hash_list, active_list
swap_page_add(rp1, entry);
swap_active_list_add(rp1);
assert(PageSwap(rp1));
mem_map[1] = 0;
entry = try_alloc_swap_entry();
assert(swap_offset(entry) == 1);
assert(!PageSwap(rp1));
// check swap_remove_entry
assert(swap_hash_find(entry) == NULL);
mem_map[1] = 2;
swap_remove_entry(entry);
assert(mem_map[1] == 1);
swap_page_add(rp1, entry);
swap_inactive_list_add(rp1);
swap_remove_entry(entry);
assert(PageSwap(rp1));
assert(rp1->index == entry && mem_map[1] == 0);
// check page_launder, move page from inactive_list to active_list
assert(page_ref(rp1) == 1);
assert(nr_active_pages == 0 && nr_inactive_pages == 1);
assert(list_next(&(inactive_list.swap_list)) == &(rp1->swap_link));
page_launder();
assert(nr_active_pages == 1 && nr_inactive_pages == 0);
assert(PageSwap(rp1) && PageActive(rp1));
entry = try_alloc_swap_entry();
assert(swap_offset(entry) == 1);
assert(!PageSwap(rp1) && nr_active_pages == 0);
assert(list_empty(&(active_list.swap_list)));
// set rp1 inactive again
assert(page_ref(rp1) == 1);
swap_page_add(rp1, 0);
assert(PageSwap(rp1) && swap_offset(rp1->index) == 1);
swap_inactive_list_add(rp1);
mem_map[1] = 1;
assert(nr_inactive_pages == 1);
page_ref_dec(rp1);
size_t count = nr_used_pages();
swap_remove_entry(entry);
assert(nr_inactive_pages == 0 && nr_used_pages() == count - 1);
//.........这里部分代码省略.........
开发者ID:chyyuu,项目名称:ucore-arch-arm,代码行数:101,代码来源:swap.c
示例19: lru_cache_add_file
void lru_cache_add_file(struct page *page)
{
if (PageActive(page))
ClearPageActive(page);
__lru_cache_add(page);
}
开发者ID:Lyude,项目名称:linux,代码行数:6,代码来源:swap.c
示例20: __free_pages_ok
static void __free_pages_ok (struct page *page, unsigned int order)
{
unsigned long index, page_idx, mask, flags;
free_area_t *area;
struct page *base;
zone_t *zone;
/*
* Yes, think what happens when other parts of the kernel take
* a reference to a page in order to pin it for io. -ben
*/
if (PageLRU(page)) {
if (unlikely(in_interrupt()))
BUG();
lru_cache_del(page);
}
if (page->buffers)
BUG();
if (page->mapping)
BUG();
if (!VALID_PAGE(page))
BUG();
if (PageLocked(page))
BUG();
if (PageActive(page))
BUG();
page->flags &= ~((1<<PG_referenced) | (1<<PG_dirty));
if (current->flags & PF_FREE_PAGES)
goto local_freelist;
back_local_freelist:
zone = page_zone(page);
mask = (~0UL) << order;
base = zone->zone_mem_map;
page_idx = page - base;
if (page_idx & ~mask)
BUG();
index = page_idx >> (1 + order);
area = zone->free_area + order;
spin_lock_irqsave(&zone->lock, flags);
zone->free_pages -= mask;
while (mask + (1 << (MAX_ORDER-1))) {
struct page *buddy1, *buddy2;
if (area >= zone->free_area + MAX_ORDER)
BUG();
if (!__test_and_change_bit(index, area->map))
/*
* the buddy page is still allocated.
*/
break;
/*
* Move the buddy up one level.
* This code is taking advantage of the identity:
* -mask = 1+~mask
*/
buddy1 = base + (page_idx ^ -mask);
buddy2 = base + page_idx;
if (BAD_RANGE(zone,buddy1))
BUG();
if (BAD_RANGE(zone,buddy2))
BUG();
list_del(&buddy1->list);
mask <<= 1;
area++;
index >>= 1;
page_idx &= mask;
}
list_add(&(base + page_idx)->list, &area->free_list);
spin_unlock_irqrestore(&zone->lock, flags);
return;
local_freelist:
if (current->nr_local_pages)
goto back_local_freelist;
if (in_interrupt())
goto back_local_freelist;
list_add(&page->list, ¤t->local_pages);
page->index = order;
current->nr_local_pages++;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:91,代码来源:page_alloc.c
注:本文中的PageActive函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论