summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorKefeng Wang <wangkefeng.wang@huawei.com>2026-09-02 21:16:53 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-10-06 17:39:39 -0700
commit44b74ec3ae5ac2f7773d5656e43aae7b29303b74 (patch)
tree223ace8105ec8469cb89cb70d4772d5b7d9ceffb /include/linux
parent27517f701ff3b6ab226423cfa67593825d5a60b4 (diff)
mm: replace PF_KCOMPACTD flag with kthread_func() check
PF_KCOMPACTD was introduced by commit ce6d9c1c2b5c ("NFS: fix nfs_release_folio() to not deadlock via kcompactd writeback") so nfs_release_folio() could detect kcompactd context and skip writeback. The flag is only consumed by current_is_kcompactd(), whose sole caller is nfs_release_folio(). Replace the flag-based check with kthread_func(current) == kcompactd, freeing the 0x00010000 PF flag bit. Link: https://lore.kernel.org/20260902131653.1338227-5-wangkefeng.wang@huawei.com Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Shakeel Butt <shakeel.butt@linux.dev> Acked-by: Zi Yan <ziy@nvidia.com> Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org> Reviewed-by: David Hildenbrand (Arm) <david@kernel.org> Cc: Brendan Jackman <brendan.jackman@linux.dev> Cc: Carlos Maiolino <cem@kernel.org> Cc: Christian Brauner <brauner@kernel.org> Cc: Christoph Hellwig <hch@lst.de> Cc: "Darrick J. Wong" <djwong@kernel.org> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Suren Baghdasaryan <surenb@google.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/compaction.h11
-rw-r--r--include/linux/sched.h2
2 files changed, 7 insertions, 6 deletions
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 66a2f70e9e01..691c09f0a697 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -81,10 +81,6 @@ static inline unsigned long compact_gap(unsigned int order)
return min(2UL << order, COMPACT_CLUSTER_MAX);
}
-static inline int current_is_kcompactd(void)
-{
- return current->flags & PF_KCOMPACTD;
-}
#ifdef CONFIG_COMPACTION
@@ -103,7 +99,7 @@ extern void compaction_defer_reset(struct zone *zone, int order,
bool compaction_zonelist_suitable(struct alloc_context *ac, int order,
int alloc_flags, gfp_t gfp_mask);
-
+bool current_is_kcompactd(void);
extern void __meminit kcompactd_run(int nid);
extern void __meminit kcompactd_stop(int nid);
extern void wakeup_kcompactd(pg_data_t *pgdat, int order, int highest_zoneidx);
@@ -120,6 +116,11 @@ static inline bool compaction_suitable(struct zone *zone, int order,
return false;
}
+static inline bool current_is_kcompactd(void)
+{
+ return false;
+}
+
static inline void kcompactd_run(int nid)
{
}
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 90393bd53bbc..f45b7d43113c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1809,7 +1809,7 @@ extern struct pid __rcu *cad_pid;
#define PF_USED_MATH 0x00002000 /* If unset the fpu must be initialized before use */
#define PF_USER_WORKER 0x00004000 /* Kernel thread cloned from userspace thread */
#define PF_NOFREEZE 0x00008000 /* This thread should not be frozen */
-#define PF_KCOMPACTD 0x00010000 /* I am kcompactd */
+#define PF__HOLE__00010000 0x00010000
#define PF__HOLE__00020000 0x00020000
#define PF_MEMALLOC_NOFS 0x00040000 /* All allocations inherit GFP_NOFS. See memalloc_nfs_save() */
#define PF_MEMALLOC_NOIO 0x00080000 /* All allocations inherit GFP_NOIO. See memalloc_noio_save() */