Files
stambha/third_party/patches/linux/0043-avoid-page-lookup.patch
T

42 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tyler Smith <74526874+tylertms@users.noreply.github.com>
Date: Tue, 3 Nov 2026 04:37:21 +0000
Subject: [PATCH] fix(mm): avoid page lookup for single-node list LRU
---
mm/list_lru.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/list_lru.c b/mm/list_lru.c
index 36662d02ff96310bccf7eb1c22cd166d8bc5bcf4..5b0ffe45d45b77fbe067151800556a07e4de1a8d 100644
--- a/mm/list_lru.c
+++ b/mm/list_lru.c
@@ -12,7 +12,9 @@
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/memcontrol.h>
+#ifdef CONFIG_MEMCG
#include "slab.h"
+#endif
#include "internal.h"
static inline void lock_list_lru(struct list_lru_one *l, bool irq,
@@ -247,7 +249,7 @@ bool list_lru_add_irq(struct list_lru *lru, struct list_head *item,
bool list_lru_add_obj(struct list_lru *lru, struct list_head *item)
{
bool ret;
- int nid = page_to_nid(virt_to_page(item));
+ int nid = IS_ENABLED(CONFIG_NUMA) ? page_to_nid(virt_to_page(item)) : 0;
if (list_lru_memcg_aware(lru)) {
rcu_read_lock();
@@ -277,7 +279,7 @@ bool list_lru_del(struct list_lru *lru, struct list_head *item, int nid,
bool list_lru_del_obj(struct list_lru *lru, struct list_head *item)
{
bool ret;
- int nid = page_to_nid(virt_to_page(item));
+ int nid = IS_ENABLED(CONFIG_NUMA) ? page_to_nid(virt_to_page(item)) : 0;
if (list_lru_memcg_aware(lru)) {
rcu_read_lock();