Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1259497 > unrolled thread

[PATCH 3/3] freezer: warn if anyone is trying to use freezer on kthreads

Started byJiri Kosina <jikos@kernel.org>
First post2015-10-30 14:50 +0100
Last post2015-10-30 14:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/3] freezer: warn if anyone is trying to use freezer on  kthreads Jiri Kosina <jikos@kernel.org> - 2015-10-30 14:50 +0100

#1259497 — [PATCH 3/3] freezer: warn if anyone is trying to use freezer on kthreads

FromJiri Kosina <jikos@kernel.org>
Date2015-10-30 14:50 +0100
Subject[PATCH 3/3] freezer: warn if anyone is trying to use freezer on kthreads
Message-ID<qpie5-6qe-5@gated-at.bofh.it>
From: Jiri Kosina <jkosina@suse.cz>

kthread freezing has been deprecated in favor of fs freezing. Issue
a warning if anyone attempts to still use this API.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
---
 include/linux/freezer.h | 2 ++
 kernel/freezer.c        | 1 +
 2 files changed, 3 insertions(+)

diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 81335f6..c0bc520 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -59,6 +59,8 @@ static inline bool try_to_freeze_unsafe(void)
 
 static inline bool try_to_freeze(void)
 {
+	WARN_ON(current->flags & PF_KTHREAD);
+
 	if (!(current->flags & PF_NOFREEZE))
 		debug_check_no_locks_held();
 	return try_to_freeze_unsafe();
diff --git a/kernel/freezer.c b/kernel/freezer.c
index a8900a3..fe2afb9 100644
--- a/kernel/freezer.c
+++ b/kernel/freezer.c
@@ -164,6 +164,7 @@ void __thaw_task(struct task_struct *p)
 bool set_freezable(void)
 {
 	might_sleep();
+	WARN_ON(current->flags & PF_KTHREAD);
 
 	/*
 	 * Modify flags while holding freezer_lock.  This ensures the
-- 
1.9.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web