Skip to content
  1. Feb 01, 2020
    • Akinobu Mita's avatar
      thermal: remove kelvin to/from Celsius conversion helpers from <linux/thermal.h> · cdf309fb
      Akinobu Mita authored
      
      
      This removes the kelvin to/from Celsius conversion helper macros in
      <linux/thermal.h> which were switched to the inline helper functions in
      <linux/units.h>.
      
      Link: http://lkml.kernel.org/r/1576386975-7941-9-git-send-email-akinobu.mita@gmail.com
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Sujith Thomas <sujith.thomas@intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Andy Shevchenko <andy@infradead.org>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Amit Kucheria <amit.kucheria@verdurent.com>
      Cc: Jean Delvare <jdelvare@suse.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Keith Busch <kbusch@kernel.org>
      Cc: Jens Axboe <axboe@fb.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
      Cc: Hartmut Knaack <knaack.h@gmx.de>
      Cc: Johannes Berg <johannes.berg@intel.com>
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Luca Coelho <luciano.coelho@intel.com>
      Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
      Cc: Stanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cdf309fb
    • Akinobu Mita's avatar
      nvme: hwmon: switch to use <linux/units.h> helpers · 7724cd2b
      Akinobu Mita authored
      
      
      This switches the nvme driver to use kelvin_to_millicelsius() and
      millicelsius_to_kelvin() in <linux/units.h>.
      
      Link: http://lkml.kernel.org/r/1576386975-7941-8-git-send-email-akinobu.mita@gmail.com
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Reviewed-by: default avatarKeith Busch <kbusch@kernel.org>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Sujith Thomas <sujith.thomas@intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Andy Shevchenko <andy@infradead.org>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Amit Kucheria <amit.kucheria@verdurent.com>
      Cc: Jean Delvare <jdelvare@suse.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Keith Busch <kbusch@kernel.org>
      Cc: Jens Axboe <axboe@fb.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
      Cc: Hartmut Knaack <knaack.h@gmx.de>
      Cc: Johannes Berg <johannes.berg@intel.com>
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Luca Coelho <luciano.coelho@intel.com>
      Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
      Cc: Stanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7724cd2b
    • Akinobu Mita's avatar
      thermal: intel_pch: switch to use <linux/units.h> helpers · 97a0a49d
      Akinobu Mita authored
      
      
      This switches the intel pch thermal driver to use
      deci_kelvin_to_millicelsius() in <linux/units.h> instead of helpers in
      <linux/thermal.h>.
      
      This is preparation for centralizing the kelvin to/from Celsius
      conversion helpers in <linux/units.h>.
      
      Link: http://lkml.kernel.org/r/1576386975-7941-7-git-send-email-akinobu.mita@gmail.com
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Sujith Thomas <sujith.thomas@intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Andy Shevchenko <andy@infradead.org>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Amit Kucheria <amit.kucheria@verdurent.com>
      Cc: Jean Delvare <jdelvare@suse.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Keith Busch <kbusch@kernel.org>
      Cc: Jens Axboe <axboe@fb.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
      Cc: Hartmut Knaack <knaack.h@gmx.de>
      Cc: Johannes Berg <johannes.berg@intel.com>
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Luca Coelho <luciano.coelho@intel.com>
      Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
      Cc: Stanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      97a0a49d
    • Akinobu Mita's avatar
      thermal: int340x: switch to use <linux/units.h> helpers · 006a6021
      Akinobu Mita authored
      
      
      This switches the int340x thermal zone driver to use
      deci_kelvin_to_millicelsius() and millicelsius_to_deci_kelvin() in
      <linux/units.h> instead of helpers in <linux/thermal.h>.
      
      This is preparation for centralizing the kelvin to/from Celsius
      conversion helpers in <linux/units.h>.
      
      Link: http://lkml.kernel.org/r/1576386975-7941-6-git-send-email-akinobu.mita@gmail.com
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Sujith Thomas <sujith.thomas@intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Andy Shevchenko <andy@infradead.org>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Amit Kucheria <amit.kucheria@verdurent.com>
      Cc: Jean Delvare <jdelvare@suse.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Keith Busch <kbusch@kernel.org>
      Cc: Jens Axboe <axboe@fb.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
      Cc: Hartmut Knaack <knaack.h@gmx.de>
      Cc: Johannes Berg <johannes.berg@intel.com>
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Luca Coelho <luciano.coelho@intel.com>
      Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
      Cc: Stanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      006a6021
    • Akinobu Mita's avatar
      platform/x86: intel_menlow: switch to use <linux/units.h> helpers · dccad6f7
      Akinobu Mita authored
      
      
      This switches the intel_menlow driver to use deci_kelvin_to_celsius()
      and celsius_to_deci_kelvin() in <linux/units.h> instead of helpers in
      <linux/thermal.h>.
      
      This is preparation for centralizing the kelvin to/from Celsius
      conversion helpers in <linux/units.h>.
      
      This also removes a trailing space, while we're at it.
      
      Link: http://lkml.kernel.org/r/1576386975-7941-5-git-send-email-akinobu.mita@gmail.com
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Sujith Thomas <sujith.thomas@intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Andy Shevchenko <andy@infradead.org>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Amit Kucheria <amit.kucheria@verdurent.com>
      Cc: Jean Delvare <jdelvare@suse.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Keith Busch <kbusch@kernel.org>
      Cc: Jens Axboe <axboe@fb.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
      Cc: Hartmut Knaack <knaack.h@gmx.de>
      Cc: Johannes Berg <johannes.berg@intel.com>
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Luca Coelho <luciano.coelho@intel.com>
      Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
      Cc: Stanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      dccad6f7
    • Akinobu Mita's avatar
      platform/x86: asus-wmi: switch to use <linux/units.h> helpers · f07b9fdf
      Akinobu Mita authored
      
      
      The asus-wmi driver doesn't implement the thermal device functionality
      directly, so including <linux/thermal.h> just for
      DECI_KELVIN_TO_CELSIUS() is a bit odd.
      
      This switches the asus-wmi driver to use deci_kelvin_to_millicelsius()
      in <linux/units.h>.
      
      The format string is changed from %d to %ld due to function returned
      type.
      
      Link: http://lkml.kernel.org/r/1576386975-7941-4-git-send-email-akinobu.mita@gmail.com
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Acked-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Sujith Thomas <sujith.thomas@intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Andy Shevchenko <andy@infradead.org>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Amit Kucheria <amit.kucheria@verdurent.com>
      Cc: Jean Delvare <jdelvare@suse.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Keith Busch <kbusch@kernel.org>
      Cc: Jens Axboe <axboe@fb.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
      Cc: Hartmut Knaack <knaack.h@gmx.de>
      Cc: Johannes Berg <johannes.berg@intel.com>
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Luca Coelho <luciano.coelho@intel.com>
      Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
      Cc: Stanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f07b9fdf
    • Akinobu Mita's avatar
      ACPI: thermal: switch to use <linux/units.h> helpers · 7f49a5cb
      Akinobu Mita authored
      
      
      This switches the ACPI thermal zone driver to use
      celsius_to_deci_kelvin(), deci_kelvin_to_celsius(), and
      deci_kelvin_to_millicelsius_with_offset() in <linux/units.h> instead of
      helpers in <linux/thermal.h>.
      
      This is preparation for centralizing the kelvin to/from Celsius
      conversion helpers in <linux/units.h>.
      
      Link: http://lkml.kernel.org/r/1576386975-7941-3-git-send-email-akinobu.mita@gmail.com
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Sujith Thomas <sujith.thomas@intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Andy Shevchenko <andy@infradead.org>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Amit Kucheria <amit.kucheria@verdurent.com>
      Cc: Jean Delvare <jdelvare@suse.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Keith Busch <kbusch@kernel.org>
      Cc: Jens Axboe <axboe@fb.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
      Cc: Hartmut Knaack <knaack.h@gmx.de>
      Cc: Johannes Berg <johannes.berg@intel.com>
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Luca Coelho <luciano.coelho@intel.com>
      Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
      Cc: Stanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7f49a5cb
    • Akinobu Mita's avatar
      include/linux/units.h: add helpers for kelvin to/from Celsius conversion · 23331e48
      Akinobu Mita authored
      
      
      Patch series "add header file for kelvin to/from Celsius conversion
      helpers", v4.
      
      There are several helper macros to convert kelvin to/from Celsius in
      <linux/thermal.h> for thermal drivers.  These are useful for any other
      drivers or subsystems, but it's odd to include <linux/thermal.h> just
      for the helpers.
      
      This adds a new <linux/units.h> that provides the equivalent inline
      functions for any drivers or subsystems, and switches all the users of
      conversion helpers in <linux/thermal.h> to use <linux/units.h> helpers.
      
      This patch (of 12):
      
      There are several helper macros to convert kelvin to/from Celsius in
      <linux/thermal.h> for thermal drivers.  These are useful for any other
      drivers or subsystems, but it's odd to include <linux/thermal.h> just
      for the helpers.
      
      This adds a new <linux/units.h> that provides the equivalent inline
      functions for any drivers or subsystems.  It is intended to replace the
      helpers in <linux/thermal.h>.
      
      Link: http://lkml.kernel.org/r/1576386975-7941-2-git-send-email-akinobu.mita@gmail.com
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Sujith Thomas <sujith.thomas@intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Amit Kucheria <amit.kucheria@verdurent.com>
      Cc: Jean Delvare <jdelvare@suse.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Keith Busch <kbusch@kernel.org>
      Cc: Jens Axboe <axboe@fb.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: Stanislaw Gruszka <sgruszka@redhat.com>
      Cc: Johannes Berg <johannes.berg@intel.com>
      Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
      Cc: Luca Coelho <luciano.coelho@intel.com>
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: Hartmut Knaack <knaack.h@gmx.de>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
      Cc: Andy Shevchenko <andy@infradead.org>
      Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      23331e48
    • Colin Ian King's avatar
      drivers/block/zram/zram_drv.c: fix error return codes not being returned in writeback_store · 3b82a051
      Colin Ian King authored
      Currently when an error code -EIO or -ENOSPC in the for-loop of
      writeback_store the error code is being overwritten by a ret = len
      assignment at the end of the function and the error codes are being
      lost.  Fix this by assigning ret = len at the start of the function and
      remove the assignment from the end, hence allowing ret to be preserved
      when error codes are assigned to it.
      
      Addresses Coverity ("Unused value")
      
      Link: http://lkml.kernel.org/r/20191128122958.178290-1-colin.king@canonical.com
      Fixes: a939888e
      
       ("zram: support idle/huge page writeback")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Acked-by: default avatarMinchan Kim <minchan@kernel.org>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3b82a051
    • Taejoon Song's avatar
      zram: try to avoid worst-case scenario on same element pages · 90f82cbf
      Taejoon Song authored
      
      
      The worst-case scenario on finding same element pages is that almost all
      elements are same at the first glance but only last few elements are
      different.
      
      Since the same element tends to be grouped from the beginning of the
      pages, if we check the first element with the last element before
      looping through all elements, we might have some chances to quickly
      detect non-same element pages.
      
       1. Test is done under LG webOS TV (64-bit arch)
       2. Dump the swap-out pages (~819200 pages)
       3. Analyze the pages with simple test script which counts the iteration
          number and measures the speed at off-line
      
      Under 64-bit arch, the worst iteration count is PAGE_SIZE / 8 bytes =
      512.  The speed is based on the time to consume page_same_filled()
      function only.  The result, on average, is listed as below:
      
                                           Num of Iter    Speed(MB/s)
        Looping-Forward (Orig)                 38            99265
        Looping-Backward                       36           102725
        Last-element-check (This Patch)        33           125072
      
      The result shows that the average iteration count decreases by 13% and
      the speed increases by 25% with this patch.  This patch does not
      increase the overall time complexity, though.
      
      I also ran simpler version which uses backward loop.  Just looping
      backward also makes some improvement, but less than this patch.
      
      [taejoon.song@lge.com: fix off-by-one]
        Link: http://lkml.kernel.org/r/1578642001-11765-1-git-send-email-taejoon.song@lge.com
      Link: http://lkml.kernel.org/r/1575424418-16119-1-git-send-email-taejoon.song@lge.com
      Signed-off-by: default avatarTaejoon Song <taejoon.song@lge.com>
      Acked-by: default avatarMinchan Kim <minchan@kernel.org>
      Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      90f82cbf
    • Hao Lee's avatar
      mm: fix comments related to node reclaim · 0a3c5772
      Hao Lee authored
      
      
      As zone reclaim has been replaced by node reclaim, this patch fixes
      related comments.
      
      Link: http://lkml.kernel.org/r/20191126141346.GA22665@haolee.github.io
      Signed-off-by: default avatarHao Lee <haolee.swjtu@gmail.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0a3c5772
    • Anshuman Khandual's avatar
      include/linux/memory.h: drop fields 'hw' and 'phys_callback' from struct memory_block · 06896454
      Anshuman Khandual authored
      memory_block structure elements 'hw' and 'phys_callback' are not getting
      used.  This was originally added with commit 3947be19
      
       ("[PATCH]
      memory hotplug: sysfs and add/remove functions") but never seem to have
      been used.  Just drop them now.
      
      Link: http://lkml.kernel.org/r/1576728650-13867-1-git-send-email-anshuman.khandual@arm.com
      Signed-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Reviewed-by: default avatarDan Williams <dan.j.williams@intel.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      06896454
    • Wei Yang's avatar
      include/linux/mm.h: remove dead code totalram_pages_set() · ca023a92
      Wei Yang authored
      totalram_pages_set() was introduced in commit ca79b0c2
      
       ("mm: convert
      totalram_pages and totalhigh_pages variables to atomic"), but no one
      uses it.
      
      Link: http://lkml.kernel.org/r/20191218005543.24146-1-richardw.yang@linux.intel.com
      Signed-off-by: default avatarWei Yang <richardw.yang@linux.intel.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ca023a92
    • Yu Zhao's avatar
      include/linux/mm.h: clean up obsolete check on space in page->flags · 26b56e11
      Yu Zhao authored
      
      
      The check was intended to make sure we don't overrun page flags.  But
      it's obsolete because it doesn't include LAST_CPUPID_WIDTH nor
      KASAN_TAG_WIDTH.
      
      Just remove check since we already have it covered in
      linux/page-flags-layout.h (near the end of the file).
      
      Link: http://lkml.kernel.org/r/20191208183508.89177-1-yuzhao@google.com
      Signed-off-by: default avatarYu Zhao <yuzhao@google.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      26b56e11
    • Dan Carpenter's avatar
      zswap: potential NULL dereference on error in init_zswap() · 38aeb071
      Dan Carpenter authored
      
      
      The "pool" pointer can be NULL at the end of the init_zswap().  (We
      would allocate a new pool later in that situation)
      
      So in the error handling then we need to make sure pool is a valid
      pointer before calling "zswap_pool_destroy(pool);" because that function
      dereferences the argument.
      
      Link: http://lkml.kernel.org/r/20200114050902.og32fkllkod5ycf5@kili.mountain
      Fixes: 93d4dfa9fbd0 ("mm/zswap.c: add allocation hysteresis if pool limit is hit")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Cc: Vitaly Wool <vitaly.wool@konsulko.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      38aeb071
    • Vitaly Wool's avatar
      mm/zswap.c: add allocation hysteresis if pool limit is hit · 45190f01
      Vitaly Wool authored
      
      
      zswap will always try to shrink pool when zswap is full.  If there is a
      high pressure on zswap it will result in flipping pages in and out zswap
      pool without any real benefit, and the overall system performance will
      drop.  The previous discussion on this subject [1] ended up with a
      suggestion to implement a sort of hysteresis to refuse taking pages into
      zswap pool until it has sufficient space if the limit has been hit.
      This is my take on this.
      
      Hysteresis is controlled with a sysfs-configurable parameter (namely,
      /sys/kernel/debug/zswap/accept_threhsold_percent).  It specifies the
      threshold at which zswap would start accepting pages again after it
      became full.  Setting this parameter to 100 disables the hysteresis and
      sets the zswap behavior to pre-hysteresis state.
      
      [1] https://lkml.org/lkml/2019/11/8/949
      
      Link: http://lkml.kernel.org/r/20200108200118.15563-1-vitaly.wool@konsulko.com
      Signed-off-by: default avatarVitaly Wool <vitaly.wool@konsulko.com>
      Cc: Dan Streetman <ddstreet@ieee.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      45190f01
    • Qian Cai's avatar
      mm/page_isolation: fix potential warning from user · 3d680bdf
      Qian Cai authored
      
      
      It makes sense to call the WARN_ON_ONCE(zone_idx(zone) == ZONE_MOVABLE)
      from start_isolate_page_range(), but should avoid triggering it from
      userspace, i.e, from is_mem_section_removable() because it could crash
      the system by a non-root user if warn_on_panic is set.
      
      While at it, simplify the code a bit by removing an unnecessary jump
      label.
      
      Link: http://lkml.kernel.org/r/20200120163915.1469-1-cai@lca.pw
      Signed-off-by: default avatarQian Cai <cai@lca.pw>
      Suggested-by: default avatarMichal Hocko <mhocko@kernel.org>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3d680bdf
    • Qian Cai's avatar
      mm/hotplug: silence a lockdep splat with printk() · 4a55c047
      Qian Cai authored
      
      
      It is not that hard to trigger lockdep splats by calling printk from
      under zone->lock.  Most of them are false positives caused by lock
      chains introduced early in the boot process and they do not cause any
      real problems (although most of the early boot lock dependencies could
      happen after boot as well).  There are some console drivers which do
      allocate from the printk context as well and those should be fixed.  In
      any case, false positives are not that trivial to workaround and it is
      far from optimal to lose lockdep functionality for something that is a
      non-issue.
      
      So change has_unmovable_pages() so that it no longer calls dump_page()
      itself - instead it returns a "struct page *" of the unmovable page back
      to the caller so that in the case of a has_unmovable_pages() failure,
      the caller can call dump_page() after releasing zone->lock.  Also, make
      dump_page() is able to report a CMA page as well, so the reason string
      from has_unmovable_pages() can be removed.
      
      Even though has_unmovable_pages doesn't hold any reference to the
      returned page this should be reasonably safe for the purpose of
      reporting the page (dump_page) because it cannot be hotremoved in the
      context of memory unplug.  The state of the page might change but that
      is the case even with the existing code as zone->lock only plays role
      for free pages.
      
      While at it, remove a similar but unnecessary debug-only printk() as
      well.  A sample of one of those lockdep splats is,
      
        WARNING: possible circular locking dependency detected
        ------------------------------------------------------
        test.sh/8653 is trying to acquire lock:
        ffffffff865a4460 (console_owner){-.-.}, at:
        console_unlock+0x207/0x750
      
        but task is already holding lock:
        ffff88883fff3c58 (&(&zone->lock)->rlock){-.-.}, at:
        __offline_isolated_pages+0x179/0x3e0
      
        which lock already depends on the new lock.
      
        the existing dependency chain (in reverse order) is:
      
        -> #3 (&(&zone->lock)->rlock){-.-.}:
               __lock_acquire+0x5b3/0xb40
               lock_acquire+0x126/0x280
               _raw_spin_lock+0x2f/0x40
               rmqueue_bulk.constprop.21+0xb6/0x1160
               get_page_from_freelist+0x898/0x22c0
               __alloc_pages_nodemask+0x2f3/0x1cd0
               alloc_pages_current+0x9c/0x110
               allocate_slab+0x4c6/0x19c0
               new_slab+0x46/0x70
               ___slab_alloc+0x58b/0x960
               __slab_alloc+0x43/0x70
               __kmalloc+0x3ad/0x4b0
               __tty_buffer_request_room+0x100/0x250
               tty_insert_flip_string_fixed_flag+0x67/0x110
               pty_write+0xa2/0xf0
               n_tty_write+0x36b/0x7b0
               tty_write+0x284/0x4c0
               __vfs_write+0x50/0xa0
               vfs_write+0x105/0x290
               redirected_tty_write+0x6a/0xc0
               do_iter_write+0x248/0x2a0
               vfs_writev+0x106/0x1e0
               do_writev+0xd4/0x180
               __x64_sys_writev+0x45/0x50
               do_syscall_64+0xcc/0x76c
               entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
        -> #2 (&(&port->lock)->rlock){-.-.}:
               __lock_acquire+0x5b3/0xb40
               lock_acquire+0x126/0x280
               _raw_spin_lock_irqsave+0x3a/0x50
               tty_port_tty_get+0x20/0x60
               tty_port_default_wakeup+0xf/0x30
               tty_port_tty_wakeup+0x39/0x40
               uart_write_wakeup+0x2a/0x40
               serial8250_tx_chars+0x22e/0x440
               serial8250_handle_irq.part.8+0x14a/0x170
               serial8250_default_handle_irq+0x5c/0x90
               serial8250_interrupt+0xa6/0x130
               __handle_irq_event_percpu+0x78/0x4f0
               handle_irq_event_percpu+0x70/0x100
               handle_irq_event+0x5a/0x8b
               handle_edge_irq+0x117/0x370
               do_IRQ+0x9e/0x1e0
               ret_from_intr+0x0/0x2a
               cpuidle_enter_state+0x156/0x8e0
               cpuidle_enter+0x41/0x70
               call_cpuidle+0x5e/0x90
               do_idle+0x333/0x370
               cpu_startup_entry+0x1d/0x1f
               start_secondary+0x290/0x330
               secondary_startup_64+0xb6/0xc0
      
        -> #1 (&port_lock_key){-.-.}:
               __lock_acquire+0x5b3/0xb40
               lock_acquire+0x126/0x280
               _raw_spin_lock_irqsave+0x3a/0x50
               serial8250_console_write+0x3e4/0x450
               univ8250_console_write+0x4b/0x60
               console_unlock+0x501/0x750
               vprintk_emit+0x10d/0x340
               vprintk_default+0x1f/0x30
               vprintk_func+0x44/0xd4
               printk+0x9f/0xc5
      
        -> #0 (console_owner){-.-.}:
               check_prev_add+0x107/0xea0
               validate_chain+0x8fc/0x1200
               __lock_acquire+0x5b3/0xb40
               lock_acquire+0x126/0x280
               console_unlock+0x269/0x750
               vprintk_emit+0x10d/0x340
               vprintk_default+0x1f/0x30
               vprintk_func+0x44/0xd4
               printk+0x9f/0xc5
               __offline_isolated_pages.cold.52+0x2f/0x30a
               offline_isolated_pages_cb+0x17/0x30
               walk_system_ram_range+0xda/0x160
               __offline_pages+0x79c/0xa10
               offline_pages+0x11/0x20
               memory_subsys_offline+0x7e/0xc0
               device_offline+0xd5/0x110
               state_store+0xc6/0xe0
               dev_attr_store+0x3f/0x60
               sysfs_kf_write+0x89/0xb0
               kernfs_fop_write+0x188/0x240
               __vfs_write+0x50/0xa0
               vfs_write+0x105/0x290
               ksys_write+0xc6/0x160
               __x64_sys_write+0x43/0x50
               do_syscall_64+0xcc/0x76c
               entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
        other info that might help us debug this:
      
        Chain exists of:
          console_owner --> &(&port->lock)->rlock --> &(&zone->lock)->rlock
      
         Possible unsafe locking scenario:
      
               CPU0                    CPU1
               ----                    ----
          lock(&(&zone->lock)->rlock);
                                       lock(&(&port->lock)->rlock);
                                       lock(&(&zone->lock)->rlock);
          lock(console_owner);
      
         *** DEADLOCK ***
      
        9 locks held by test.sh/8653:
         #0: ffff88839ba7d408 (sb_writers#4){.+.+}, at:
        vfs_write+0x25f/0x290
         #1: ffff888277618880 (&of->mutex){+.+.}, at:
        kernfs_fop_write+0x128/0x240
         #2: ffff8898131fc218 (kn->count#115){.+.+}, at:
        kernfs_fop_write+0x138/0x240
         #3: ffffffff86962a80 (device_hotplug_lock){+.+.}, at:
        lock_device_hotplug_sysfs+0x16/0x50
         #4: ffff8884374f4990 (&dev->mutex){....}, at:
        device_offline+0x70/0x110
         #5: ffffffff86515250 (cpu_hotplug_lock.rw_sem){++++}, at:
        __offline_pages+0xbf/0xa10
         #6: ffffffff867405f0 (mem_hotplug_lock.rw_sem){++++}, at:
        percpu_down_write+0x87/0x2f0
         #7: ffff88883fff3c58 (&(&zone->lock)->rlock){-.-.}, at:
        __offline_isolated_pages+0x179/0x3e0
         #8: ffffffff865a4920 (console_lock){+.+.}, at:
        vprintk_emit+0x100/0x340
      
        stack backtrace:
        Hardware name: HPE ProLiant DL560 Gen10/ProLiant DL560 Gen10,
        BIOS U34 05/21/2019
        Call Trace:
         dump_stack+0x86/0xca
         print_circular_bug.cold.31+0x243/0x26e
         check_noncircular+0x29e/0x2e0
         check_prev_add+0x107/0xea0
         validate_chain+0x8fc/0x1200
         __lock_acquire+0x5b3/0xb40
         lock_acquire+0x126/0x280
         console_unlock+0x269/0x750
         vprintk_emit+0x10d/0x340
         vprintk_default+0x1f/0x30
         vprintk_func+0x44/0xd4
         printk+0x9f/0xc5
         __offline_isolated_pages.cold.52+0x2f/0x30a
         offline_isolated_pages_cb+0x17/0x30
         walk_system_ram_range+0xda/0x160
         __offline_pages+0x79c/0xa10
         offline_pages+0x11/0x20
         memory_subsys_offline+0x7e/0xc0
         device_offline+0xd5/0x110
         state_store+0xc6/0xe0
         dev_attr_store+0x3f/0x60
         sysfs_kf_write+0x89/0xb0
         kernfs_fop_write+0x188/0x240
         __vfs_write+0x50/0xa0
         vfs_write+0x105/0x290
         ksys_write+0xc6/0x160
         __x64_sys_write+0x43/0x50
         do_syscall_64+0xcc/0x76c
         entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Link: http://lkml.kernel.org/r/20200117181200.20299-1-cai@lca.pw
      Signed-off-by: default avatarQian Cai <cai@lca.pw>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4a55c047
    • David Hildenbrand's avatar
      mm/memory_hotplug: pass in nid to online_pages() · bd5c2344
      David Hildenbrand authored
      
      
      Patch series "mm/memory_hotplug: pass in nid to online_pages()".
      
      Simplify onlining code and get rid of find_memory_block().  Pass in the
      nid from the memory block we are trying to online directly, instead of
      manually looking it up.
      
      This patch (of 2):
      
      No need to lookup the memory block, we can directly pass in the nid.
      
      Link: http://lkml.kernel.org/r/20200113113354.6341-2-david@redhat.com
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Oscar Salvador <osalvador@suse.de>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bd5c2344
    • Miaohe Lin's avatar
      mm/mmap.c: get rid of odd jump labels in find_mergeable_anon_vma() · a67c8caa
      Miaohe Lin authored
      
      
      The jump labels try_prev and none are not really needed in
      find_mergeable_anon_vma(), eliminate them to improve readability.
      
      Link: http://lkml.kernel.org/r/1574079844-17493-1-git-send-email-linmiaohe@huawei.com
      Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reviewed-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
      Reviewed-by: default avatarWei Yang <richardw.yang@linux.intel.com>
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a67c8caa
    • David Rientjes's avatar
      mm, thp: fix defrag setting if newline is not used · f42f2552
      David Rientjes authored
      If thp defrag setting "defer" is used and a newline is *not* used when
      writing to the sysfs file, this is interpreted as the "defer+madvise"
      option.
      
      This is because we do prefix matching and if five characters are written
      without a newline, the current code ends up comparing to the first five
      bytes of the "defer+madvise" option and using that instead.
      
      Use the more appropriate sysfs_streq() that handles the trailing newline
      for us.  Since this doubles as a nice cleanup, do it in enabled_store()
      as well.
      
      The current implementation relies on prefix matching: the number of
      bytes compared is either the number of bytes written or the length of
      the option being compared.  With a newline, "defer\n" does not match
      "defer+"madvise"; without a newline, however, "defer" is considered to
      match "defer+madvise" (prefix matching is only comparing the first five
      bytes).  End result is that writing "defer" is broken unless it has an
      additional trailing character.
      
      This means that writing "madv" in the past would match and set
      "madvise".  With strict checking, that no longer is the case but it is
      unlikely anybody is currently doing this.
      
      Link: http://lkml.kernel.org/r/alpine.DEB.2.21.2001171411020.56385@chino.kir.corp.google.com
      Fixes: 21440d7e
      
       ("mm, thp: add new defer+madvise defrag option")
      Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
      Suggested-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f42f2552
    • Ralph Campbell's avatar
      mm/migrate: add stable check in migrate_vma_insert_page() · 34290e2c
      Ralph Campbell authored
      
      
      migrate_vma_insert_page() closely follows the code in:
        __handle_mm_fault()
          handle_pte_fault()
            do_anonymous_page()
      
      Add a call to check_stable_address_space() after locking the page table
      entry before inserting a ZONE_DEVICE private zero page mapping similar
      to page faulting a new anonymous page.
      
      Link: http://lkml.kernel.org/r/20200107211208.24595-4-rcampbell@nvidia.com
      Signed-off-by: default avatarRalph Campbell <rcampbell@nvidia.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: Jason Gunthorpe <jgg@mellanox.com>
      Cc: Bharata B Rao <bharata@linux.ibm.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Chris Down <chris@chrisdown.name>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      34290e2c
    • Ralph Campbell's avatar
      mm/migrate: clean up some minor coding style · c23a0c99
      Ralph Campbell authored
      
      
      Fix some comment typos and coding style clean up in preparation for the
      next patch.  No functional changes.
      
      Link: http://lkml.kernel.org/r/20200107211208.24595-3-rcampbell@nvidia.com
      Signed-off-by: default avatarRalph Campbell <rcampbell@nvidia.com>
      Acked-by: default avatarChris Down <chris@chrisdown.name>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: Jason Gunthorpe <jgg@mellanox.com>
      Cc: Bharata B Rao <bharata@linux.ibm.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c23a0c99
    • Ralph Campbell's avatar
      mm/migrate: remove useless mask of start address · 872ea707
      Ralph Campbell authored
      
      
      Addresses passed to walk_page_range() callback functions are already
      page aligned and don't need to be masked with PAGE_MASK.
      
      Link: http://lkml.kernel.org/r/20200107211208.24595-2-rcampbell@nvidia.com
      Signed-off-by: default avatarRalph Campbell <rcampbell@nvidia.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: Jason Gunthorpe <jgg@mellanox.com>
      Cc: Bharata B Rao <bharata@linux.ibm.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Chris Down <chris@chrisdown.name>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      872ea707
    • Wei Yang's avatar
      mm/huge_memory.c: reduce critical section protected by split_queue_lock · afb97172
      Wei Yang authored
      split_queue_lock protects data in struct deferred_split.  We can release
      the lock after delete the page from deferred_split_queue.
      
      This patch moves the THP accounting out of the lock protection, which is
      introduced in commit 65c45377
      
       ("mm, rmap: account shmem thp pages").
      
      Link: http://lkml.kernel.org/r/20200110025516.23996-1-richardw.yang@linux.intel.com
      Signed-off-by: default avatarWei Yang <richardw.yang@linux.intel.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      afb97172
    • Wei Yang's avatar
      mm/huge_memory.c: use head to emphasize the purpose of page · a8803e6c
      Wei Yang authored
      
      
      During split huge page, it checks the property of the page.  Currently
      we do the check on page and head without emphasizing the check is on the
      compound page.  In case the page passed to split_huge_page_to_list is a
      tail page, audience would take some time to think about whether the
      check is on compound page or tail page itself.
      
      To make it explicit, use head instead of page for those checks.  After
      this, audience would be more clear about the checks are on compound page
      and the page is used to do the split and dump error message if failed.
      
      Link: http://lkml.kernel.org/r/20200110032610.26499-2-richardw.yang@linux.intel.com
      Signed-off-by: default avatarWei Yang <richardw.yang@linux.intel.com>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a8803e6c
    • Wei Yang's avatar
      mm/huge_memory.c: use head to check huge zero page · cb829624
      Wei Yang authored
      The page could be a tail page, if this is the case, this BUG_ON will
      never be triggered.
      
      Link: http://lkml.kernel.org/r/20200110032610.26499-1-richardw.yang@linux.intel.com
      Fixes: e9b61f19
      
       ("thp: reintroduce split_huge_page()")
      
      Signed-off-by: default avatarWei Yang <richardw.yang@linux.intel.com>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cb829624
    • David Rientjes's avatar
      mm, oom: dump stack of victim when reaping failed · 8a7ff02a
      David Rientjes authored
      
      
      When a process cannot be oom reaped, for whatever reason, currently the
      list of locks that are held is currently dumped to the kernel log.
      
      Much more interesting is the stack trace of the victim that cannot be
      reaped.  If the stack trace is dumped, we have the ability to find
      related occurrences in the same kernel code and hopefully solve the
      issue that is making it wedged.
      
      Dump the stack trace when a process fails to be oom reaped.
      
      Link: http://lkml.kernel.org/r/alpine.DEB.2.21.2001141519280.200484@chino.kir.corp.google.com
      Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8a7ff02a
    • Anshuman Khandual's avatar
      memblock: Use __func__ in remaining memblock_dbg() call sites · a090d711
      Anshuman Khandual authored
      
      
      Replace open function name strings with %s (__func__) in all remaining
      memblock_dbg() call sites.
      
      Link: http://lkml.kernel.org/r/1578285510-28261-1-git-send-email-anshuman.khandual@arm.com
      Signed-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Reviewed-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a090d711
    • Anshuman Khandual's avatar
      mm/memblock: define memblock_physmem_add() · 02634a44
      Anshuman Khandual authored
      
      
      On the s390 platform memblock.physmem array is being built by directly
      calling into memblock_add_range() which is a low level function not
      intended to be used outside of memblock.  Hence lets conditionally add
      helper functions for physmem array when HAVE_MEMBLOCK_PHYS_MAP is
      enabled.  Also use MAX_NUMNODES instead of 0 as node ID similar to
      memblock_add() and memblock_reserve().  Make memblock_add_range() a
      static function as it is no longer getting used outside of memblock.
      
      Link: http://lkml.kernel.org/r/1578283835-21969-1-git-send-email-anshuman.khandual@arm.com
      Signed-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Reviewed-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Collin Walling <walling@linux.ibm.com>
      Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
      Cc: Philipp Rudo <prudo@linux.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      02634a44
    • Daniel Wagner's avatar
      tools/vm/slabinfo: fix sanity checks enabling · e25974aa
      Daniel Wagner authored
      
      
      The sysfs file name for enabling sanity checking is called
      'sanity_checks' and not 'sanity'.
      
      The name of the file has never changed since the introduction of the
      slub allocator.  Obviously, most people turn the checks on via the
      command line option and not during runtime using slabinfo.
      
      Link: http://lkml.kernel.org/r/20200116131642.642-1-dwagner@suse.de
      Signed-off-by: default avatarDaniel Wagner <dwagner@suse.de>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: "Tobin C. Harding" <tobin@kernel.org>
      Cc: Christoph Lameter <cl@linux.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e25974aa
    • Alex Shi's avatar
      mm/vmscan: remove unused RECLAIM_OFF/RECLAIM_ZONE · 648b5cf3
      Alex Shi authored
      Commit 1b2ffb78
      
       ("[PATCH] Zone reclaim: Allow modification of zone
      reclaim behavior")' defined RECLAIM_OFF/RECLAIM_ZONE, but never use
      them, so better to remove them.
      
      [dwagner@suse.de: fix sanity checks enabling]
        Link: http://lkml.kernel.org/r/20200116131642.642-1-dwagner@suse.de
      [akpm@linux-foundation.org: renumber the bits for neatness]
      Link: http://lkml.kernel.org/r/1579005573-58923-1-git-send-email-alex.shi@linux.alibaba.com
      Signed-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Signed-off-by: default avatarDaniel Wagner <dwagner@suse.de>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: "Tobin C. Harding" <tobin@kernel.org>
      Cc: Christoph Lameter <cl@linux.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      648b5cf3
    • Alex Shi's avatar
      mm/vmscan: remove prefetch_prev_lru_page · fffbacc1
      Alex Shi authored
      
      
      This macro was never used in git history.  So better to remove.
      
      Link: http://lkml.kernel.org/r/1579006500-127143-1-git-send-email-alex.shi@linux.alibaba.com
      Signed-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Qian Cai <cai@lca.pw>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fffbacc1
    • Liu Song's avatar
      mm/vmscan.c: remove unused return value of shrink_node · 6c9e0907
      Liu Song authored
      
      
      The return value of shrink_node is not used, so remove unnecessary
      operations.
      
      Link: http://lkml.kernel.org/r/20191128143524.3223-1-fishland@aliyun.com
      Signed-off-by: default avatarLiu Song <liu.song11@zte.com.cn>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6c9e0907
    • David Hildenbrand's avatar
      mm: remove "count" parameter from has_unmovable_pages() · fe4c86c9
      David Hildenbrand authored
      
      
      Now that the memory isolate notifier is gone, the parameter is always 0.
      Drop it and cleanup has_unmovable_pages().
      
      Link: http://lkml.kernel.org/r/20191114131911.11783-3-david@redhat.com
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Oscar Salvador <osalvador@suse.de>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Qian Cai <cai@lca.pw>
      Cc: Pingfan Liu <kernelfans@gmail.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: Wei Yang <richardw.yang@linux.intel.com>
      Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Arun KS <arunks@codeaurora.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fe4c86c9
    • David Hildenbrand's avatar
      mm: remove the memory isolate notifier · 3f9903b9
      David Hildenbrand authored
      
      
      Luckily, we have no users left, so we can get rid of it.  Cleanup
      set_migratetype_isolate() a little bit.
      
      Link: http://lkml.kernel.org/r/20191114131911.11783-2-david@redhat.com
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Oscar Salvador <osalvador@suse.de>
      Cc: Qian Cai <cai@lca.pw>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Pingfan Liu <kernelfans@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3f9903b9
    • Kirill A. Shutemov's avatar
      mm/page_alloc: skip non present sections on zone initialization · 3f135355
      Kirill A. Shutemov authored
      
      
      memmap_init_zone() can be called on the ranges with holes during the
      boot.  It will skip any non-valid PFNs one-by-one.  It works fine as
      long as holes are not too big.
      
      But huge holes in the memory map causes a problem.  It takes over 20
      seconds to walk 32TiB hole.  x86-64 with 5-level paging allows for much
      larger holes in the memory map which would practically hang the system.
      
      Deferred struct page init doesn't help here.  It only works on the
      present ranges.
      
      Skipping non-present sections would fix the issue.
      
      Link: http://lkml.kernel.org/r/20191230093828.24613-1-kirill.shutemov@linux.intel.com
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Reviewed-by: default avatarBaoquan He <bhe@redhat.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: "Jin, Zhi" <zhi.jin@intel.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Oscar Salvador <osalvador@suse.de>
      Cc: Pavel Tatashin <pasha.tatashin@oracle.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3f135355
    • Andy Shevchenko's avatar
      mm/early_ioremap.c: use %pa to print resource_size_t variables · 7b69d79f
      Andy Shevchenko authored
      
      
      %pa takes into consideration the special types such as resource_size_t.
      Use this specifier %instead of explicit casting.
      
      Link: http://lkml.kernel.org/r/20191209165413.56263-1-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7b69d79f
    • Gustavo A. R. Silva's avatar
      lib/test_kasan.c: fix memory leak in kmalloc_oob_krealloc_more() · 3e21d9a5
      Gustavo A. R. Silva authored
      In case memory resources for _ptr2_ were allocated, release them before
      return.
      
      Notice that in case _ptr1_ happens to be NULL, krealloc() behaves
      exactly like kmalloc().
      
      Addresses-Coverity-ID: 1490594 ("Resource leak")
      Link: http://lkml.kernel.org/r/20200123160115.GA4202@embeddedor
      Fixes: 3f15801c
      
       ("lib: add kasan test module")
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3e21d9a5
    • Junyong Sun's avatar
      mm, tracing: print symbol name for kmem_alloc_node call_site events · 7e168b9b
      Junyong Sun authored
      
      
      Print the call_site ip of kmem_alloc_node using '%pS' to improve the
      readability of raw slab trace points.
      
      Link: http://lkml.kernel.org/r/1577949568-4518-1-git-send-email-sunjunyong@xiaomi.com
      Signed-off-by: default avatarJunyong Sun <sunjunyong@xiaomi.com>
      Acked-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Joel Fernandes (Google) <joel@joelfernandes.org>
      Cc: Changbin Du <changbin.du@intel.com>
      Cc: Tim Murray <timmurray@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7e168b9b