Skip to content
  • Joonsoo Kim's avatar
    mm/page_ext: support extra space allocation by page_ext user · 980ac167
    Joonsoo Kim authored
    Until now, if some page_ext users want to use it's own field on
    page_ext, it should be defined in struct page_ext by hard-coding.  It
    has a problem that wastes memory in following situation.
    
      struct page_ext {
       #ifdef CONFIG_A
      	int a;
       #endif
       #ifdef CONFIG_B
      	int b;
       #endif
      };
    
    Assume that kernel is built with both CONFIG_A and CONFIG_B.  Even if we
    enable feature A and doesn't enable feature B at runtime, each entry of
    struct page_ext takes two int rather than one int.  It's undesirable
    result so this patch tries to fix it.
    
    To solve above problem, this patch implements to support extra space
    allocation at runtime.  When need() callback returns true, it's extra
    memory requirement is summed to entry size of page_ext.  Also, offset
    for each user's extra memory space is returned.  With this offset, user
    can use this extra space and there is no need to define needed field on
    page_ext by hard-coding.
    
    This patch only implements an i...
    980ac167