build/patch/kernel/archive/rk322x-5.17/0003-mglru-framework-armhf-fix.patch

75 lines
2.6 KiB
Diff

a patch from the multi gen lru patch series author (yu zhao) to fix some
problems i saw on armv7l and some compile problems i saw on aarch64 with
CONFIG_CC_OPTIMIZE_FOR_SIZE enabled
"Thanks for the report. Please try the attached patch -- it should fix both of the problems.
We routinely test the MGLRU patchset on both 32-bit and 64-bit ARM CPUs. Our configs and compiler are different.
The build error smells like a gcc bug. It doesn't happen with clang.
The crash on 32-bit happens when CONFIG_PGTABLE_LEVELS=2. Mine is unfortunately set to 3.
Please feel free to let me know if there is anything else I can do to help."
diff --git a/mm/Kconfig b/mm/Kconfig
index 05291697055a..e2e0be0d2e33 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -915,6 +915,7 @@ config LRU_GEN
depends on MMU
# make sure folio->flags has enough spare bits
depends on 64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP
+ default y
help
A high performance LRU implementation to overcommit memory. See
Documentation/admin-guide/mm/multigen_lru.rst for details.
@@ -922,6 +923,7 @@ config LRU_GEN
config LRU_GEN_ENABLED
bool "Enable by default"
depends on LRU_GEN
+ default y
help
This option enables the multi-gen LRU by default.
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 479cf221b59d..fe0c6475a6b4 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2993,8 +2993,10 @@ static bool can_age_anon_pages(struct pglist_data *pgdat,
#ifdef CONFIG_LRU_GEN_ENABLED
DEFINE_STATIC_KEY_ARRAY_TRUE(lru_gen_caps, NR_LRU_GEN_CAPS);
+#define get_cap(cap) static_branch_likely(&lru_gen_caps[cap])
#else
DEFINE_STATIC_KEY_ARRAY_FALSE(lru_gen_caps, NR_LRU_GEN_CAPS);
+#define get_cap(cap) static_branch_unlikely(&lru_gen_caps[cap])
#endif
/******************************************************************************
@@ -3017,15 +3019,6 @@ DEFINE_STATIC_KEY_ARRAY_FALSE(lru_gen_caps, NR_LRU_GEN_CAPS);
for ((type) = 0; (type) < ANON_AND_FILE; (type)++) \
for ((zone) = 0; (zone) < MAX_NR_ZONES; (zone)++)
-static bool get_cap(int cap)
-{
-#ifdef CONFIG_LRU_GEN_ENABLED
- return static_branch_likely(&lru_gen_caps[cap]);
-#else
- return static_branch_unlikely(&lru_gen_caps[cap]);
-#endif
-}
-
static struct lruvec *get_lruvec(struct mem_cgroup *memcg, int nid)
{
struct pglist_data *pgdat = NODE_DATA(nid);
@@ -4442,7 +4435,7 @@ void lru_gen_look_around(struct page_vma_mapped_walk *pvmw)
return;
start = max(pvmw->address & PMD_MASK, pvmw->vma->vm_start);
- end = pmd_addr_end(pvmw->address, pvmw->vma->vm_end);
+ end = min(pvmw->address | ~PMD_MASK, pvmw->vma->vm_end - 1) + 1;
if (end - start > MIN_LRU_BATCH * PAGE_SIZE) {
if (pvmw->address - start < MIN_LRU_BATCH * PAGE_SIZE / 2)