30 Apr, 2013

40 commits

  • Use helper function free_highmem_page() to free highmem pages into
    the buddy system.

    Signed-off-by: Jiang Liu
    Cc: Jeff Dike
    Cc: Richard Weinberger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use helper function free_highmem_page() to free highmem pages into
    the buddy system.

    Signed-off-by: Jiang Liu
    Cc: "David S. Miller"
    Acked-by: Sam Ravnborg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use helper function free_highmem_page() to free highmem pages into
    the buddy system.

    Signed-off-by: Jiang Liu
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Jiang Liu
    Cc: Alexander Graf
    Cc: "Suzuki K. Poulose"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use helper function free_highmem_page() to free highmem pages into
    the buddy system.

    Signed-off-by: Jiang Liu
    Cc: Ralf Baechle
    Cc: David Daney
    Cc: Cong Wang
    Cc: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use helper function free_highmem_page() to free highmem pages into
    the buddy system.

    Signed-off-by: Jiang Liu
    Cc: Michal Simek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use helper function free_highmem_page() to free highmem pages into
    the buddy system.

    Signed-off-by: Jiang Liu
    Cc: James Hogan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use helper function free_highmem_page() to free highmem pages into
    the buddy system.

    Also fix a bug that totalhigh_pages should be increased when freeing
    a highmem page into the buddy system.

    Signed-off-by: Jiang Liu
    Cc: David Howells
    Cc: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use helper function free_highmem_page() to free highmem pages into
    the buddy system.

    Signed-off-by: Jiang Liu
    Cc: Russell King
    Cc: Linus Walleij
    Cc: Marek Szyprowski
    Cc: Stephen Boyd
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • The original goal of this patchset is to fix the bug reported by

    https://bugzilla.kernel.org/show_bug.cgi?id=53501

    Now it has also been expanded to reduce common code used by memory
    initializion.

    This is the second part, which applies to the previous part at:
    http://marc.info/?l=linux-mm&m=136289696323825&w=2

    It introduces a helper function free_highmem_page() to free highmem
    pages into the buddy system when initializing mm subsystem.
    Introduction of free_highmem_page() is one step forward to clean up
    accesses and modificaitons of totalhigh_pages, totalram_pages and
    zone->managed_pages etc. I hope we could remove all references to
    totalhigh_pages from the arch/ subdirectory.

    We have only tested these patchset on x86 platforms, and have done basic
    compliation tests using cross-compilers from ftp.kernel.org. That means
    some code may not pass compilation on some architectures. So any help
    to test this patchset are welcomed!

    There are several other parts still under development:
    Part3: refine code to manage totalram_pages, totalhigh_pages and
    zone->managed_pages
    Part4: introduce helper functions to simplify mem_init() and remove the
    global variable num_physpages.

    This patch:

    Introduce helper function free_highmem_page(), which will be used by
    architectures with HIGHMEM enabled to free highmem pages into the buddy
    system.

    Signed-off-by: Jiang Liu
    Cc: "David S. Miller"
    Cc: "H. Peter Anvin"
    Cc: "Suzuki K. Poulose"
    Cc: Alexander Graf
    Cc: Arnd Bergmann
    Cc: Attilio Rao
    Cc: Benjamin Herrenschmidt
    Cc: Cong Wang
    Cc: David Daney
    Cc: David Howells
    Cc: Geert Uytterhoeven
    Cc: Ingo Molnar
    Cc: James Hogan
    Cc: Jeff Dike
    Cc: Jiang Liu
    Cc: Jiang Liu
    Cc: Konrad Rzeszutek Wilk
    Cc: Konstantin Khlebnikov
    Cc: Linus Walleij
    Cc: Marek Szyprowski
    Cc: Mel Gorman
    Cc: Michal Nazarewicz
    Cc: Michal Simek
    Cc: Michel Lespinasse
    Cc: Minchan Kim
    Cc: Paul Mackerras
    Cc: Ralf Baechle
    Cc: Richard Weinberger
    Cc: Rik van Riel
    Cc: Russell King
    Cc: Sam Ravnborg
    Cc: Stephen Boyd
    Cc: Thomas Gleixner
    Cc: Yinghai Lu
    Reviewed-by: Pekka Enberg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Eric Biederman
    Reviewed-by: Zhang Yanfei
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: James Hogan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Acked-by: Vineet Gupta
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Chris Zankel
    Cc: Max Filippov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Guan Xuetao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Acked-by: Paul Mundt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Chen Liqin
    Cc: Lennox Wu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Anatolij Gustschin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: "James E.J. Bottomley"
    Cc: Helge Deller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.
    Also include to avoid local declarations.

    Signed-off-by: Jiang Liu
    Cc: Jonas Bonn
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Koichi Yasutake
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Ralf Baechle
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Michal Simek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Acked-by: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.
    Also include to avoid local declarations.

    Signed-off-by: Jiang Liu
    Cc: Hirokazu Takata
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Tony Luck
    Cc: Fenghua Yu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.
    Also include to avoid local declaration.

    Signed-off-by: Jiang Liu
    Cc: Mikael Starvik
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Mark Salter
    Cc: Aurelien Jacquiot
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Mike Frysinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Acked-by: Hans-Christian Egtvedt
    Cc: Haavard Skinnemoen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages.

    Signed-off-by: Jiang Liu
    Cc: Russell King
    Cc: Catalin Marinas
    Cc: Will Deacon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Use common help functions to free reserved pages. Also include
    to avoid local declarations.

    Signed-off-by: Jiang Liu
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Matt Turner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • The original goal of this patchset is to fix the bug reported by

    https://bugzilla.kernel.org/show_bug.cgi?id=53501

    Now it has also been expanded to reduce common code used by memory
    initializion.

    This is the first part, which applies to v3.9-rc1.

    It introduces following common helper functions to simplify
    free_initmem() and free_initrd_mem() on different architectures:

    adjust_managed_page_count():
    will be used to adjust totalram_pages, totalhigh_pages,
    zone->managed_pages when reserving/unresering a page.

    __free_reserved_page():
    free a reserved page into the buddy system without adjusting
    page statistics info

    free_reserved_page():
    free a reserved page into the buddy system and adjust page
    statistics info

    mark_page_reserved():
    mark a page as reserved and adjust page statistics info

    free_reserved_area():
    free a continous ranges of pages by calling free_reserved_page()

    free_initmem_default():
    default method to free __init pages.

    We have only tested these patchset on x86 platforms, and have done basic
    compliation tests using cross-compilers from ftp.kernel.org. That means
    some code may not pass compilation on some architectures. So any help to
    test this patchset are welcomed!

    There are several other parts still under development:
    Part2: introduce free_highmem_page() to simplify freeing highmem pages
    Part3: refine code to manage totalram_pages, totalhigh_pages and
    zone->managed_pages
    Part4: introduce helper functions to simplify mem_init() and remove the
    global variable num_physpages.

    This patch:

    Code to deal with reserved/managed pages are duplicated by many
    architectures, so introduce common help functions to reduce duplicated
    code. These common help functions will also be used to concentrate code
    to modify totalram_pages and zone->managed_pages, which makes the code
    much more clear.

    Signed-off-by: Jiang Liu
    Acked-by: Geert Uytterhoeven
    Cc: "H. Peter Anvin"
    Cc: "James E.J. Bottomley"
    Cc: Anatolij Gustschin
    Cc: Aurelien Jacquiot
    Cc: Benjamin Herrenschmidt
    Cc: Catalin Marinas
    Cc: Chen Liqin
    Cc: Chris Zankel
    Cc: David Howells
    Cc: David S. Miller
    Cc: Eric Biederman
    Cc: Fenghua Yu
    Cc: Guan Xuetao
    Cc: Haavard Skinnemoen
    Cc: Hans-Christian Egtvedt
    Cc: Heiko Carstens
    Cc: Helge Deller
    Cc: Hirokazu Takata
    Cc: Ingo Molnar
    Cc: Ivan Kokshaysky
    Cc: James Hogan
    Cc: Jeff Dike
    Cc: Jiang Liu
    Cc: Jiang Liu
    Cc: Jonas Bonn
    Cc: Koichi Yasutake
    Cc: Lennox Wu
    Cc: Mark Salter
    Cc: Martin Schwidefsky
    Cc: Matt Turner
    Cc: Max Filippov
    Cc: Michal Simek
    Cc: Mikael Starvik
    Cc: Mike Frysinger
    Cc: Paul Mackerras
    Cc: Paul Mundt
    Cc: Ralf Baechle
    Cc: Richard Henderson
    Cc: Russell King
    Cc: Sam Ravnborg
    Cc: Thomas Gleixner
    Cc: Tony Luck
    Cc: Vineet Gupta
    Cc: Will Deacon
    Cc: Yoshinori Sato
    Cc: Zhang Yanfei
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiang Liu
     
  • Local variable total_scanned is no longer used.

    Signed-off-by: Hillf Danton
    Acked-by: Rik van Riel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hillf Danton
     
  • Currently, dio_send_cur_page() submits bio before current page and cached
    sdio->cur_page is added to the bio if sdio->boundary is set. This is
    actually wrong because sdio->boundary means the current buffer is the last
    one before metadata needs to be read. So we should rather submit the bio
    after the current page is added to it.

    Signed-off-by: Jan Kara
    Reported-by: Kazuya Mio
    Tested-by: Kazuya Mio
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kara
     
  • When we read/write a file sequentially, we will read/write not only the
    data blocks but also the indirect blocks that may not be physically
    adjacent to the data blocks. So filesystems set the BH_Boundary flag to
    submit the previous I/O before reading/writing an indirect block.

    However the generic direct IO code mishandles buffer_boundary(), setting
    sdio->boundary before each submit_page_section() call which results in
    sending only one page bios as underlying code thinks this page is the last
    in the contiguous extent. So fix the problem by setting sdio->boundary
    only if the current page is really the last one in the mapped extent.

    With this patch and "direct-io: submit bio after boundary buffer is added
    to it" I've measured about 10% throughput improvement of direct IO reads
    on ext3 with SATA harddrive (from 90 MB/s to 100 MB/s). With ramdisk, the
    improvement was about 3-fold (from 350 MB/s to 1.2 GB/s). For other
    filesystems (such as ext4), the improvements won't be as visible because
    the frequency of BH_Boundary flag being set is much smaller.

    Signed-off-by: Jan Kara
    Reported-by: Kazuya Mio
    Tested-by: Kazuya Mio
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kara