mm: refactor si_mem_available()
authorLorenzo Stoakes <lstoakes@gmail.com>
Sun, 27 Aug 2023 11:08:48 +0000 (12:08 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 4 Oct 2023 17:32:19 +0000 (10:32 -0700)
commit80e4a765a770c491e081463c38be927a876e2ce8
treedf1f9f9d1ba4e688d23d4fe3c2021d531066679b
parentb72b3c9c34c825c81d205241c5f822fc7835923f
mm: refactor si_mem_available()

si_mem_available() needlessly places LRU statistics into an array before
retrieving only two of them, simply access those directly.

In addition, refactor the code so that the blocks of code which calculate
the page cache and reclaimable components each resemble one another to
clearly indicate we cap both against wmark_low in the same fashion.

Link: https://lkml.kernel.org/r/20230827110848.43510-1-lstoakes@gmail.com
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/show_mem.c