Lines Matching full:addr

40 void write_fault_pages(void *addr, unsigned long nr_pages)  in write_fault_pages()  argument
45 *((unsigned long *)(addr + (i * huge_page_size))) = i; in write_fault_pages()
48 void read_fault_pages(void *addr, unsigned long nr_pages) in read_fault_pages() argument
54 dummy += *((unsigned long *)(addr + (i * huge_page_size))); in read_fault_pages()
64 void *addr, *addr2; in main() local
92 * Test validity of MADV_DONTNEED addr and length arguments. mmap in main()
97 addr = mmap(NULL, (NR_HUGE_PAGES + 2) * huge_page_size, in main()
101 if (addr == MAP_FAILED) { in main()
105 if (munmap(addr, huge_page_size) || in main()
106 munmap(addr + (NR_HUGE_PAGES + 1) * huge_page_size, in main()
111 addr = addr + huge_page_size; in main()
113 write_fault_pages(addr, NR_HUGE_PAGES); in main()
116 /* addr before mapping should fail */ in main()
117 ret = madvise(addr - base_page_size, NR_HUGE_PAGES * huge_page_size, in main()
120 printf("Unexpected success of madvise call with invalid addr line %d\n", in main()
125 /* addr + length after mapping should fail */ in main()
126 ret = madvise(addr, (NR_HUGE_PAGES * huge_page_size) + base_page_size, in main()
134 (void)munmap(addr, NR_HUGE_PAGES * huge_page_size); in main()
137 * Test alignment of MADV_DONTNEED addr and length arguments in main()
139 addr = mmap(NULL, NR_HUGE_PAGES * huge_page_size, in main()
143 if (addr == MAP_FAILED) { in main()
147 write_fault_pages(addr, NR_HUGE_PAGES); in main()
150 /* addr is not huge page size aligned and should fail */ in main()
151 ret = madvise(addr + base_page_size, in main()
160 /* addr + length should be aligned down to huge page size */ in main()
161 if (madvise(addr, in main()
171 (void)munmap(addr, NR_HUGE_PAGES * huge_page_size); in main()
177 addr = mmap(NULL, NR_HUGE_PAGES * huge_page_size, in main()
181 if (addr == MAP_FAILED) { in main()
185 write_fault_pages(addr, NR_HUGE_PAGES); in main()
188 if (madvise(addr, NR_HUGE_PAGES * huge_page_size, MADV_DONTNEED)) { in main()
196 (void)munmap(addr, NR_HUGE_PAGES * huge_page_size); in main()
207 addr = mmap(NULL, NR_HUGE_PAGES * huge_page_size, in main()
210 if (addr == MAP_FAILED) { in main()
216 read_fault_pages(addr, NR_HUGE_PAGES); in main()
220 if (madvise(addr, NR_HUGE_PAGES * huge_page_size, MADV_DONTNEED)) { in main()
227 write_fault_pages(addr, NR_HUGE_PAGES); in main()
231 if (madvise(addr, NR_HUGE_PAGES * huge_page_size, MADV_DONTNEED)) { in main()
238 write_fault_pages(addr, NR_HUGE_PAGES); in main()
255 (void)munmap(addr, NR_HUGE_PAGES * huge_page_size); in main()
266 addr = mmap(NULL, NR_HUGE_PAGES * huge_page_size, in main()
269 if (addr == MAP_FAILED) { in main()
275 write_fault_pages(addr, NR_HUGE_PAGES); in main()
279 if (madvise(addr, NR_HUGE_PAGES * huge_page_size, MADV_DONTNEED)) { in main()
290 if (madvise(addr, NR_HUGE_PAGES * huge_page_size, MADV_REMOVE)) { in main()
295 (void)munmap(addr, NR_HUGE_PAGES * huge_page_size); in main()
306 addr = mmap(NULL, NR_HUGE_PAGES * huge_page_size, in main()
309 if (addr == MAP_FAILED) { in main()
315 write_fault_pages(addr, NR_HUGE_PAGES); in main()
335 if (madvise(addr, NR_HUGE_PAGES * huge_page_size, MADV_DONTNEED)) { in main()
357 if (madvise(addr, NR_HUGE_PAGES * huge_page_size, MADV_REMOVE)) { in main()
363 (void)munmap(addr, NR_HUGE_PAGES * huge_page_size); in main()