mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
To: "James E.J. Bottomley" <jejb@parisc-linux.org>,
	Helge Deller <deller@gmx.de>
Cc: Tejun Heo <tj@kernel.org>,
	linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] parisc: led: Remove deprecated create_singlethread_workqueue
Date: Tue, 30 Aug 2016 22:03:43 +0530	[thread overview]
Message-ID: <20160830163343.GA25952@Karyakshetra> (raw)

The workqueue "led_wq" queues a single work item &led_task and hence
doesn't require ordering. It is involved in managing when and which
chassis LCD/LED gets updated and hence, is not being used on a memory
reclaim path. Hence, it has been converted to use system_wq.

System workqueues have been able to handle high level of concurrency
for a long time now and hence it's not required to have a singlethreaded
workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue
created with create_singlethread_workqueue(), system_wq allows multiple
work items to overlap executions even on the same CPU; however, a
per-cpu workqueue doesn't have any CPU locality or global ordering
guarantee unless the target CPU is explicitly specified and thus the
increase of local concurrency shouldn't make any difference.

The work item has been sync cancelled in led_halt to ensure that
there are no pending tasks while disconnecting the driver.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
---
 drivers/parisc/led.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
index b482431..89dff2e 100644
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -67,7 +67,6 @@ static char lcd_text_default[32]  __read_mostly;
 static int  lcd_no_led_support    __read_mostly = 0; /* KittyHawk doesn't support LED on its LCD */


-static struct workqueue_struct *led_wq;
 static void led_work_func(struct work_struct *);
 static DECLARE_DELAYED_WORK(led_task, led_work_func);

@@ -140,8 +139,7 @@ static int start_task(void)
 	if (lcd_no_led_support) return 0;

 	/* Create the work queue and queue the LED task */
-	led_wq = create_singlethread_workqueue("led_wq");
-	queue_delayed_work(led_wq, &led_task, 0);
+	schedule_delayed_work(&led_task, 0);

 	return 0;
 }
@@ -524,12 +522,8 @@ static int led_halt(struct notifier_block *nb, unsigned long event, void *buf)
 	default:		return NOTIFY_DONE;
 	}

-	/* Cancel the work item and delete the queue */
-	if (led_wq) {
-		cancel_delayed_work_sync(&led_task);
-		destroy_workqueue(led_wq);
-		led_wq = NULL;
-	}
+	/* Cancel the work item */
+	cancel_delayed_work_sync(&led_task);

 	if (lcd_info.model == DISPLAY_MODEL_LCD)
 		lcd_print(txt);
@@ -594,9 +588,7 @@ int __init register_led_driver(int model, unsigned long cmd_reg, unsigned long d
 	register_reboot_notifier(&led_notifier);

 	/* Ensure the work is queued */
-	if (led_wq) {
-		queue_delayed_work(led_wq, &led_task, 0);
-	}
+	schedule_delayed_work(&led_task, 0);

 	return 0;
 }
@@ -644,8 +636,7 @@ int lcd_print( const char *str )
 	    return 0;

 	/* temporarily disable the led work task */
-	if (led_wq)
-		cancel_delayed_work_sync(&led_task);
+	cancel_delayed_work_sync(&led_task);

 	/* copy display string to buffer for procfs */
 	strlcpy(lcd_text, str, sizeof(lcd_text));
@@ -664,9 +655,7 @@ int lcd_print( const char *str )
 	}

 	/* re-queue the work */
-	if (led_wq) {
-		queue_delayed_work(led_wq, &led_task, 0);
-	}
+	schedule_delayed_work(&led_task, 0);

 	return lcd_info.lcd_width;
 }
--
2.1.4

             reply	other threads:[~2016-08-30 16:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-30 16:33 Bhaktipriya Shridhar [this message]
2016-08-31 14:05 ` Tejun Heo

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=20160830163343.GA25952@Karyakshetra \
    --to=bhaktipriya96@gmail.com \
    --cc=deller@gmx.de \
    --cc=jejb@parisc-linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=tj@kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®