In mm/memory.c, zap_page_ra
nge is defined as follow:
* remove user pages in a given range.
void zap_page_range(struct mm_struct *mm, unsigned long address, unsigned long size)
pgd_t * dir;
unsigned long start = address, end = address + size;
int freed = 0;
dir = pgd_offset(mm, address);
* This is a long-lived spinlock. That's fine.
* There's no contention, because the page table
* lock only protects against kswapd anyway, and
* even if kswapd happened to be looking at this
* process we _want_ it to get stuck.
if (address >= end)
flush_cache_range(mm, address, end);
tlb = tlb_gather_mmu(mm);
freed += zap_pmd_range(tlb, dir, address, end - address);
address = (address + PGDIR_SIZE) & PGDIR_MASK;
} while (address && (address < end));
/* this will flush any remaining tlb entries */
tlb_finish_mmu(tlb, start, end);
* Update rss for the mm_struct (not necessarily current->mm)
* Notice that rss is an unsigned long.
if (mm->rss > freed)
mm->rss -= freed;
mm->rss = 0;
My purpose is to create a big latency in here (between the spin locks), I mean to let this function as long as long as possible (from my user code). Can anyone give me some idea? What is associated the duration of this function?