mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
page-types: make voffset local variables
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com> Cc: Andi Kleen <andi@firstfloor.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
4a1b6726fe
commit
e577ebde9f
1 changed files with 21 additions and 18 deletions
|
@ -159,7 +159,6 @@ static unsigned long opt_size[MAX_ADDR_RANGES];
|
||||||
static int nr_vmas;
|
static int nr_vmas;
|
||||||
static unsigned long pg_start[MAX_VMAS];
|
static unsigned long pg_start[MAX_VMAS];
|
||||||
static unsigned long pg_end[MAX_VMAS];
|
static unsigned long pg_end[MAX_VMAS];
|
||||||
static unsigned long voffset;
|
|
||||||
|
|
||||||
#define MAX_BIT_FILTERS 64
|
#define MAX_BIT_FILTERS 64
|
||||||
static int nr_bit_filters;
|
static int nr_bit_filters;
|
||||||
|
@ -328,7 +327,8 @@ static char *page_flag_longname(uint64_t flags)
|
||||||
* page list and summary
|
* page list and summary
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void show_page_range(unsigned long offset, uint64_t flags)
|
static void show_page_range(unsigned long voffset,
|
||||||
|
unsigned long offset, uint64_t flags)
|
||||||
{
|
{
|
||||||
static uint64_t flags0;
|
static uint64_t flags0;
|
||||||
static unsigned long voff;
|
static unsigned long voff;
|
||||||
|
@ -354,7 +354,8 @@ static void show_page_range(unsigned long offset, uint64_t flags)
|
||||||
count = 1;
|
count = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_page(unsigned long offset, uint64_t flags)
|
static void show_page(unsigned long voffset,
|
||||||
|
unsigned long offset, uint64_t flags)
|
||||||
{
|
{
|
||||||
if (opt_pid)
|
if (opt_pid)
|
||||||
printf("%lx\t", voffset);
|
printf("%lx\t", voffset);
|
||||||
|
@ -435,7 +436,6 @@ static uint64_t well_known_flags(uint64_t flags)
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* page frame walker
|
* page frame walker
|
||||||
*/
|
*/
|
||||||
|
@ -467,7 +467,8 @@ static int hash_slot(uint64_t flags)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_page(unsigned long offset, uint64_t flags)
|
static void add_page(unsigned long voffset,
|
||||||
|
unsigned long offset, uint64_t flags)
|
||||||
{
|
{
|
||||||
flags = expand_overloaded_flags(flags);
|
flags = expand_overloaded_flags(flags);
|
||||||
|
|
||||||
|
@ -478,16 +479,18 @@ static void add_page(unsigned long offset, uint64_t flags)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (opt_list == 1)
|
if (opt_list == 1)
|
||||||
show_page_range(offset, flags);
|
show_page_range(voffset, offset, flags);
|
||||||
else if (opt_list == 2)
|
else if (opt_list == 2)
|
||||||
show_page(offset, flags);
|
show_page(voffset, offset, flags);
|
||||||
|
|
||||||
nr_pages[hash_slot(flags)]++;
|
nr_pages[hash_slot(flags)]++;
|
||||||
total_pages++;
|
total_pages++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define KPAGEFLAGS_BATCH (64 << 10) /* 64k pages */
|
#define KPAGEFLAGS_BATCH (64 << 10) /* 64k pages */
|
||||||
static void walk_pfn(unsigned long index, unsigned long count)
|
static void walk_pfn(unsigned long voffset,
|
||||||
|
unsigned long index,
|
||||||
|
unsigned long count)
|
||||||
{
|
{
|
||||||
uint64_t buf[KPAGEFLAGS_BATCH];
|
uint64_t buf[KPAGEFLAGS_BATCH];
|
||||||
unsigned long batch;
|
unsigned long batch;
|
||||||
|
@ -501,7 +504,7 @@ static void walk_pfn(unsigned long index, unsigned long count)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (i = 0; i < pages; i++)
|
for (i = 0; i < pages; i++)
|
||||||
add_page(index + i, buf[i]);
|
add_page(voffset + i, index + i, buf[i]);
|
||||||
|
|
||||||
index += pages;
|
index += pages;
|
||||||
count -= pages;
|
count -= pages;
|
||||||
|
@ -525,9 +528,8 @@ static void walk_vma(unsigned long index, unsigned long count)
|
||||||
|
|
||||||
for (i = 0; i < pages; i++) {
|
for (i = 0; i < pages; i++) {
|
||||||
pfn = pagemap_pfn(buf[i]);
|
pfn = pagemap_pfn(buf[i]);
|
||||||
voffset = index + i;
|
|
||||||
if (pfn)
|
if (pfn)
|
||||||
walk_pfn(pfn, 1);
|
walk_pfn(index + i, pfn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
index += pages;
|
index += pages;
|
||||||
|
@ -537,8 +539,9 @@ static void walk_vma(unsigned long index, unsigned long count)
|
||||||
|
|
||||||
static void walk_task(unsigned long index, unsigned long count)
|
static void walk_task(unsigned long index, unsigned long count)
|
||||||
{
|
{
|
||||||
int i = 0;
|
|
||||||
const unsigned long end = index + count;
|
const unsigned long end = index + count;
|
||||||
|
unsigned long start;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
while (index < end) {
|
while (index < end) {
|
||||||
|
|
||||||
|
@ -548,11 +551,11 @@ static void walk_task(unsigned long index, unsigned long count)
|
||||||
if (pg_start[i] >= end)
|
if (pg_start[i] >= end)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
voffset = max_t(unsigned long, pg_start[i], index);
|
start = max_t(unsigned long, pg_start[i], index);
|
||||||
index = min_t(unsigned long, pg_end[i], end);
|
index = min_t(unsigned long, pg_end[i], end);
|
||||||
|
|
||||||
assert(voffset < index);
|
assert(start < index);
|
||||||
walk_vma(voffset, index - voffset);
|
walk_vma(start, index - start);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,7 +580,7 @@ static void walk_addr_ranges(void)
|
||||||
|
|
||||||
for (i = 0; i < nr_addr_ranges; i++)
|
for (i = 0; i < nr_addr_ranges; i++)
|
||||||
if (!opt_pid)
|
if (!opt_pid)
|
||||||
walk_pfn(opt_offset[i], opt_size[i]);
|
walk_pfn(0, opt_offset[i], opt_size[i]);
|
||||||
else
|
else
|
||||||
walk_task(opt_offset[i], opt_size[i]);
|
walk_task(opt_offset[i], opt_size[i]);
|
||||||
|
|
||||||
|
@ -879,7 +882,7 @@ int main(int argc, char *argv[])
|
||||||
walk_addr_ranges();
|
walk_addr_ranges();
|
||||||
|
|
||||||
if (opt_list == 1)
|
if (opt_list == 1)
|
||||||
show_page_range(0, 0); /* drain the buffer */
|
show_page_range(0, 0, 0); /* drain the buffer */
|
||||||
|
|
||||||
if (opt_no_summary)
|
if (opt_no_summary)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue