From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754285AbcE0SuK (ORCPT ); Fri, 27 May 2016 14:50:10 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34955 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751575AbcE0SuI (ORCPT ); Fri, 27 May 2016 14:50:08 -0400 Date: Sat, 28 May 2016 00:20:02 +0530 From: Bhaktipriya Shridhar To: tj@kernel.org Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Subject: [PATCH] xen: xenbus: Remove create_workqueue Message-ID: <20160527185002.GA19321@Karyakshetra> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With concurrency managed workqueues, use of dedicated workqueues can be replaced by using system_wq. Drop xenbus_frontend_wq by using system_wq. Since there is only a single work item, increase of concurrency level by switching to system_wq should not break anything. Since the work item could be pending and the code expects it to run once scheduled, flush_work() has been used in xenbus_dev_suspend() Signed-off-by: Bhaktipriya Shridhar --- drivers/xen/xenbus/xenbus_probe.c | 2 ++ drivers/xen/xenbus/xenbus_probe_frontend.c | 15 +-------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 33a31cf..bc97019 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -592,6 +592,8 @@ int xenbus_dev_suspend(struct device *dev) DPRINTK("%s", xdev->nodename); + cancel_work_sync(&xdev->work); + if (dev->driver == NULL) return 0; drv = to_xenbus_driver(dev->driver); diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index bcb53bd..611a231 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c @@ -31,7 +31,6 @@ #include "xenbus_probe.h" -static struct workqueue_struct *xenbus_frontend_wq; /* device// => - */ static int frontend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename) @@ -109,13 +108,7 @@ static int xenbus_frontend_dev_resume(struct device *dev) if (xen_store_domain_type == XS_LOCAL) { struct xenbus_device *xdev = to_xenbus_device(dev); - if (!xenbus_frontend_wq) { - pr_err("%s: no workqueue to process delayed resume\n", - xdev->nodename); - return -EFAULT; - } - - queue_work(xenbus_frontend_wq, &xdev->work); + schedule_work(&xdev->work); return 0; } @@ -485,12 +478,6 @@ static int __init xenbus_probe_frontend_init(void) register_xenstore_notifier(&xenstore_notifier); - if (xen_store_domain_type == XS_LOCAL) { - xenbus_frontend_wq = create_workqueue("xenbus_frontend"); - if (!xenbus_frontend_wq) - pr_warn("create xenbus frontend workqueue failed, S3 resume is likely to fail\n"); - } - return 0; } subsys_initcall(xenbus_probe_frontend_init); -- 2.1.4