• Hugh Dickins's avatar
    memcg: fix hotplugged memory zone oops · bea8c150
    Hugh Dickins authored
    When MEMCG is configured on (even when it's disabled by boot option),
    when adding or removing a page to/from its lru list, the zone pointer
    used for stats updates is nowadays taken from the struct lruvec.  (On
    many configurations, calculating zone from page is slower.)
    
    But we have no code to update all the lruvecs (per zone, per memcg) when
    a memory node is hotadded.  Here's an extract from the oops which
    results when running numactl to bind a program to a newly onlined node:
    
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000f60
      IP:  __mod_zone_page_state+0x9/0x60
      Pid: 1219, comm: numactl Not tainted 3.6.0-rc5+ #180 Bochs Bochs
      Process numactl (pid: 1219, threadinfo ffff880039abc000, task ffff8800383c4ce0)
      Call Trace:
        __pagevec_lru_add_fn+0xdf/0x140
        pagevec_lru_move_fn+0xb1/0x100
        __pagevec_lru_add+0x1c/0x30
        lru_add_drain_cpu+0xa3/0x130
        lru_add_drain+0x2f/0x40
       ...
    
    The natural solution might be to use a memcg call...
    bea8c150
mmzone.c 1.9 KB