Badari Pulavarty wrote:
Hi Dave,

I am playing with "crash" on my machine with it fails with
CONFIG_SPARSE_MEM. It looks like "node_mem_map" doesn't
exist for SPARSE_MEM :(

crash: invalid structure member offset: pglist_data_node_mem_map
       FILE: memory.c  LINE: 10053  FUNCTION: dump_memory_nodes()

[./crash] error trace: 100afe98 => 100d12f4 => 100d01cc => 10142f64

  10142f64: .OFFSET_verify+140
  100d01cc: .dump_memory_nodes+520
  100d12f4: .node_table_init+492
  100afe98: .vm_init+7948

Thanks,
Badari

typedef struct pglist_data {
        struct zone node_zones[MAX_NR_ZONES];
        struct zonelist node_zonelists[GFP_ZONETYPES];
        int nr_zones;
#ifdef CONFIG_FLAT_NODE_MEM_MAP
        struct page *node_mem_map;
#endif
        struct bootmem_data *bdata;


Hmmm,, it kind of looks like the global "mem_map" array should be
used in that case, but if that were true, then there could never
be multiple pglist_data structures in that case?

Here's what I mean -- in vm_init() there's this:

        if (VALID_STRUCT(pglist_data)) {
                vt->flags |= ZONES;

                if (symbol_exists("pgdat_list"))
                        vt->flags |= NODES;

And later on in dump_memory_nodes(), which gathers the memory-related
information for each node, it looks at that "NODES" flag.

- If the NODES flag is *not* set, then it presumes that there is
  just one node, and uses the global "mem_map".

- If the NODES flag is set, then starting at the pgdat_list list head,
  it walks though each of the pglist_data structures (one per node),
  and then collects all of the individual node_mem_map pointers
  found in each node.

In this hybrid case, I don't know how exactly the mem_map
is found for each pglist_data node?  You could quickly try
not setting the vt->flags NODES bit, and seeing what happens.
But I get the feeling that there's going to more to be done
than that -- presuming that you can have more than one pglist_data
node.  In other words if the pglist_data list can have more
than one node when CONFIG_FLAT_NODE_MEM_MAP is turned off,
then we need to find out how to make the relationship between
each sparse node and its associated mem_map array.

Dave