[Crash-utility] Fix for kmem -p

David Wilder dwilder at us.ibm.com
Sat Feb 18 00:18:55 UTC 2006


Dave Anderson wrote:

> Dave Anderson wrote:  Or perhaps just put
>
>> a bunch of dashes in the MAPPING field.  Or something like
>> that.
>>
>> Dave
>>  
>>
> This is what I'm thinking -- it just puts dashes in the
> MAPPING and INDEX columns if the kernel uses this type
> of page structure:
>  
>
> --- memory.c    14 Feb 2006 20:13:46 -0000      1.112
> +++ memory.c    17 Feb 2006 20:36:58 -0000
> @@ -3482,7 +3482,7 @@
>  {
>         long i, n;
>         long total_pages;
> -       int others, page_not_mapped, phys_not_mapped;
> +       int others, page_not_mapped, phys_not_mapped, page_mapping;
>         ulong pp, ppend;
>         physaddr_t phys, physend;
>         ulong tmp, reserved, shared, slabs;
> @@ -3694,10 +3694,12 @@
>                                 continue;
>                         }
>
> +                       page_mapping = VALID_MEMBER(page_mapping);
> +
>                         if (v22) {
>                                 inode = ULONG(pcache + 
> OFFSET(page_inode));
>                                 offset = ULONG(pcache + 
> OFFSET(page_offset));
> -                       } else {
> +                       } else if (page_mapping) {
>                                 mapping = ULONG(pcache +
>                                         OFFSET(page_mapping));
>                                 index = ULONG(pcache + 
> OFFSET(page_index));
> @@ -3740,6 +3742,20 @@
>                                          space(MINSPACE),
>                                         mkstring(buf4, 8, 
> CENTER|RJUST, " "),
>                                          " ");
> +                               else if (!page_mapping)
> +                                fprintf(fp, "%s%s%s%s%s%s%s %2d ",
> +                                        mkstring(buf0, VADDR_PRLEN,
> +                                        LJUST|LONG_HEX, MKSTR(pp)),
> +                                        space(MINSPACE),
> +                                        mkstring(buf1, MAX(PADDR_PRLEN,
> +                                        strlen("PHYSICAL")),
> +                                        RJUST|LONGLONG_HEX, 
> MKSTR(&phys)),
> +                                        space(MINSPACE),
> +                                        mkstring(buf3, VADDR_PRLEN,
> +                                        CENTER|RJUST, "-------"),
> +                                        space(MINSPACE),
> +                                        mkstring(buf4, 8, 
> CENTER|RJUST, "-----"),
> +                                        count);
>                                 else
>                                  fprintf(fp, "%s%s%s%s%s%s%8ld %2d ",
>                                         mkstring(buf0, VADDR_PRLEN,
>
> Dave
>  
>
>------------------------------------------------------------------------
>
>--
>Crash-utility mailing list
>Crash-utility at redhat.com
>https://www.redhat.com/mailman/listinfo/crash-utility
>  
>
Your approach is better lets go with that.    BTW: page->mapping will 
not always be valid even if
we can find the offset .   The page can be unmapped or page->private 
will be used.
you have to check the count and the flags to know what is valid.  But 
you show those anyway.

-- 
David Wilder
IBM Linux Technology Center
Beaverton, Oregon, USA 
dwilder at us.ibm.com
(503)578-3789




More information about the Crash-utility mailing list