Thread (27 messages) 27 messages, 4 authors, 2021-12-17

Re: [PATCH v4 02/17] mm: introduce kmem_cache_alloc_lru

From: Johannes Weiner <hannes@cmpxchg.org>
Date: 2021-12-14 13:50:59
Also in: linux-fsdevel, linux-nfs, lkml

On Tue, Dec 14, 2021 at 12:53:27AM +0800, Muchun Song wrote:
+/*
+ * The allocated list lru pointers array is not accounted directly.
+ * Moreover, it should not come from DMA buffer and is not readily
+ * reclaimable. So those GFP bits should be masked off.
+ */
+#define LRUS_CLEAR_MASK	(__GFP_DMA | __GFP_RECLAIMABLE | __GFP_ACCOUNT | __GFP_ZERO)
There is already GFP_RECLAIM_MASK for this purpose, you can use that.
+int memcg_list_lru_alloc(struct mem_cgroup *memcg, struct list_lru *lru,
+			 gfp_t gfp)
+{
+	int i;
+	unsigned long flags;
+	struct list_lru_memcg *mlrus;
+	struct list_lru_memcg_table {
+		struct list_lru_per_memcg *mlru;
+		struct mem_cgroup *memcg;
+	} *table;
+
+	if (!list_lru_memcg_aware(lru) || memcg_list_lru_allocated(memcg, lru))
+		return 0;
+
+	gfp &= ~LRUS_CLEAR_MASK;
	gfp &= GFP_RECLAIM_MASK;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help