LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: LKML <linux-kernel@vger.kernel.org>
Cc: paulmck@linux.vnet.ibm.com, ego@in.ibm.com, akpm@osdl.org,
	mingo@elte.hu, vatsa@in.ibm.com, dipankar@in.ibm.com,
	venkatesh.pallipadi@intel.com, Pavel Machek <pavel@ucw.cz>,
	"Aneesh Kumar" <aneesh.kumar@gmail.com>,
	bluez-devel@lists.sourceforge.net
Subject: [RFC][PATCH 6/7] Freezer: Remove PF_NOFREEZE from bluetooth threads
Date: Fri, 23 Feb 2007 11:25:42 +0100	[thread overview]
Message-ID: <200702231125.43910.rjw@sisk.pl> (raw)
In-Reply-To: <200702231116.23607.rjw@sisk.pl>

From: Rafael J. Wysocki <rjw@sisk.pl>

Remove PF_NOFREEZE from the bluetooth threads, adding try_to_freeze() calls as
required.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 net/bluetooth/bnep/core.c   |    6 ++++--
 net/bluetooth/cmtp/core.c   |    4 +++-
 net/bluetooth/hidp/core.c   |    4 +++-
 net/bluetooth/rfcomm/core.c |    4 +++-
 4 files changed, 13 insertions(+), 5 deletions(-)

Index: linux-2.6.20-mm2/net/bluetooth/bnep/core.c
===================================================================
--- linux-2.6.20-mm2.orig/net/bluetooth/bnep/core.c	2007-02-23 00:26:58.000000000 +0100
+++ linux-2.6.20-mm2/net/bluetooth/bnep/core.c	2007-02-23 00:30:47.000000000 +0100
@@ -39,6 +39,7 @@
 #include <linux/errno.h>
 #include <linux/smp_lock.h>
 #include <linux/net.h>
+#include <linux/freezer.h>
 #include <net/sock.h>
 
 #include <linux/socket.h>
@@ -473,11 +474,12 @@ static int bnep_session(void *arg)
 
 	daemonize("kbnepd %s", dev->name);
 	set_user_nice(current, -15);
-	current->flags |= PF_NOFREEZE;
 
 	init_waitqueue_entry(&wait, current);
 	add_wait_queue(sk->sk_sleep, &wait);
 	while (!atomic_read(&s->killed)) {
+		try_to_freeze();
+
 		set_current_state(TASK_INTERRUPTIBLE);
 
 		// RX
Index: linux-2.6.20-mm2/net/bluetooth/cmtp/core.c
===================================================================
--- linux-2.6.20-mm2.orig/net/bluetooth/cmtp/core.c	2007-02-23 00:26:58.000000000 +0100
+++ linux-2.6.20-mm2/net/bluetooth/cmtp/core.c	2007-02-23 00:31:01.000000000 +0100
@@ -34,6 +34,7 @@
 #include <linux/ioctl.h>
 #include <linux/file.h>
 #include <linux/init.h>
+#include <linux/freezer.h>
 #include <net/sock.h>
 
 #include <linux/isdn/capilli.h>
@@ -287,11 +288,12 @@ static int cmtp_session(void *arg)
 
 	daemonize("kcmtpd_ctr_%d", session->num);
 	set_user_nice(current, -15);
-	current->flags |= PF_NOFREEZE;
 
 	init_waitqueue_entry(&wait, current);
 	add_wait_queue(sk->sk_sleep, &wait);
 	while (!atomic_read(&session->terminate)) {
+		try_to_freeze();
+
 		set_current_state(TASK_INTERRUPTIBLE);
 
 		if (sk->sk_state != BT_CONNECTED)
Index: linux-2.6.20-mm2/net/bluetooth/hidp/core.c
===================================================================
--- linux-2.6.20-mm2.orig/net/bluetooth/hidp/core.c	2007-02-23 00:26:58.000000000 +0100
+++ linux-2.6.20-mm2/net/bluetooth/hidp/core.c	2007-02-23 00:31:17.000000000 +0100
@@ -35,6 +35,7 @@
 #include <linux/file.h>
 #include <linux/init.h>
 #include <linux/wait.h>
+#include <linux/freezer.h>
 #include <net/sock.h>
 
 #include <linux/input.h>
@@ -547,13 +548,14 @@ static int hidp_session(void *arg)
 
 	daemonize("khidpd_%04x%04x", vendor, product);
 	set_user_nice(current, -15);
-	current->flags |= PF_NOFREEZE;
 
 	init_waitqueue_entry(&ctrl_wait, current);
 	init_waitqueue_entry(&intr_wait, current);
 	add_wait_queue(ctrl_sk->sk_sleep, &ctrl_wait);
 	add_wait_queue(intr_sk->sk_sleep, &intr_wait);
 	while (!atomic_read(&session->terminate)) {
+		try_to_freeze();
+
 		set_current_state(TASK_INTERRUPTIBLE);
 
 		if (ctrl_sk->sk_state != BT_CONNECTED || intr_sk->sk_state != BT_CONNECTED)
Index: linux-2.6.20-mm2/net/bluetooth/rfcomm/core.c
===================================================================
--- linux-2.6.20-mm2.orig/net/bluetooth/rfcomm/core.c	2007-02-23 00:26:58.000000000 +0100
+++ linux-2.6.20-mm2/net/bluetooth/rfcomm/core.c	2007-02-23 00:31:43.000000000 +0100
@@ -37,6 +37,7 @@
 #include <linux/device.h>
 #include <linux/net.h>
 #include <linux/mutex.h>
+#include <linux/freezer.h>
 
 #include <net/sock.h>
 #include <asm/uaccess.h>
@@ -1851,6 +1852,8 @@ static void rfcomm_worker(void)
 	BT_DBG("");
 
 	while (!atomic_read(&terminate)) {
+		try_to_freeze();
+
 		if (!test_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) {
 			/* No pending events. Let's sleep.
 			 * Incoming connections and data will wake us up. */
@@ -1937,7 +1940,6 @@ static int rfcomm_run(void *unused)
 
 	daemonize("krfcommd");
 	set_user_nice(current, -10);
-	current->flags |= PF_NOFREEZE;
 
 	BT_DBG("");
 


  parent reply	other threads:[~2007-02-23 11:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-23 10:16 [RFC][PATCH 0/7] Freezer: Hardening and preparation for CPU hotplug changes Rafael J. Wysocki
2007-02-23 10:18 ` [RFC][PATCH 1/7] Freezer: Read PF_BORROWED_MM in a nonracy way Rafael J. Wysocki
2007-02-25 10:43   ` Pavel Machek
2007-02-23 10:19 ` [RFC][PATCH 2/7] Freezer: Fix memory ordering in refrigerator Rafael J. Wysocki
2007-02-23 10:21 ` [RFC][PATCH 3/7] Freezer: Close theoretical race between refrigerator and thaw_tasks Rafael J. Wysocki
2007-02-25 10:44   ` Pavel Machek
2007-02-23 10:22 ` [RFC][PATCH 4/7] Freezer: Fix vfork problem Rafael J. Wysocki
2007-02-25 10:46   ` Pavel Machek
2007-02-25 10:45     ` Rafael J. Wysocki
2007-02-25 12:59       ` Rafael J. Wysocki
2007-02-25 14:33         ` Aneesh Kumar
2007-02-25 15:05           ` Rafael J. Wysocki
2007-02-25 15:28             ` Aneesh Kumar
2007-02-25 15:40               ` Aneesh Kumar
2007-02-25 19:17                 ` Rafael J. Wysocki
2007-02-25 20:31                   ` Oleg Nesterov
2007-02-25 20:33                     ` Rafael J. Wysocki
2007-02-25 13:01     ` Aneesh Kumar
2007-02-25 13:43       ` Rafael J. Wysocki
2007-02-23 10:23 ` [RFC][PATCH 5/7] Freezer: Remove PF_NOFREEZE from rcutorture thread Rafael J. Wysocki
2007-02-25 10:44   ` Pavel Machek
2007-02-23 10:25 ` Rafael J. Wysocki [this message]
2007-02-25 10:44   ` [RFC][PATCH 6/7] Freezer: Remove PF_NOFREEZE from bluetooth threads Pavel Machek
2007-02-25 23:53   ` Marcel Holtmann
2007-02-23 10:26 ` [RFC][PATCH 7/7] Freezer: Add try_to_freeze calls to all kernel threads Rafael J. Wysocki
2007-02-25 10:45   ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200702231125.43910.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=akpm@osdl.org \
    --cc=aneesh.kumar@gmail.com \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=dipankar@in.ibm.com \
    --cc=ego@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=pavel@ucw.cz \
    --cc=vatsa@in.ibm.com \
    --cc=venkatesh.pallipadi@intel.com \
    --subject='Re: [RFC][PATCH 6/7] Freezer: Remove PF_NOFREEZE from bluetooth threads' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).