Re: [PATCH] A new entry for /proc

From: Marcelo Tosatti
Date: Mon Jan 17 2005 - 15:39:36 EST



Hi Mauricio,

On Mon, Jan 17, 2005 at 03:02:14PM -0400, Mauricio Lin wrote:
> Hi Andrew,
>
> I figured out the error. This patch works for others editors as well.

<snip>

> diff -uprN linux-2.6.10/fs/proc/task_mmu.c linux-2.6.10-smaps/fs/proc/task_mmu.c
> --- linux-2.6.10/fs/proc/task_mmu.c 2004-12-24 17:34:01.000000000 -0400
> +++ linux-2.6.10-smaps/fs/proc/task_mmu.c 2005-01-17 14:55:17.000000000 -0400
> @@ -81,6 +81,76 @@ static int show_map(struct seq_file *m,
> return 0;
> }
>
> +static void resident_mem_size(struct mm_struct *mm,
> + unsigned long start_address,
> + unsigned long end_address,
> + unsigned long *size)
> +{
> + pgd_t *pgd;
> + pmd_t *pmd;
> + pte_t *ptep, pte;
> + unsigned long each_page;
> +
> + for (each_page = start_address; each_page < end_address;
> + each_page += PAGE_SIZE) {
> + pgd = pgd_offset(mm, each_page);
> + if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
> + continue;
> +
> + pmd = pmd_offset(pgd, each_page);
> +
> + if (pmd_none(*pmd))
> + continue;
> +
> + if (unlikely(pmd_bad(*pmd)))
> + continue;
> +
> + if (pmd_present(*pmd)) {
> + ptep = pte_offset_map(pmd, each_page);
> + if (!ptep)
> + continue;
> + pte = *ptep;
> + pte_unmap(ptep);
> + if (pte_present(pte))
> + *size += PAGE_SIZE;
> + }
> + }
> +}

You want to update your patch to handle the new 4level pagetables which introduces
a new indirection table: the PUD.

Check 2.6.11-rc1 - mm/rmap.c.

BTW: What does PUD stand for?




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/