Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2423727ybt; Sun, 21 Jun 2020 20:14:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz65W0jhltbW+4Gvp+w62VHY+vBzRDaDeiuL24e0GkPI9cLWYIL41cBsPobiWNtK+urKvOS X-Received: by 2002:a17:906:6b8a:: with SMTP id l10mr13213530ejr.465.1592795691746; Sun, 21 Jun 2020 20:14:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592795691; cv=none; d=google.com; s=arc-20160816; b=qpRhZpWGFJGIJwu3XWnxlH97Bduc4hzK5g9KKLZk2zU8TVNR4g4awLRL9bAg6WCJEQ 67LhDZ8ZBcy5EsM4QLsNp7Lt6tX1pQB4MKaP1KKL2jVGocXh8blcKKAaFMsMwLa07R/D lZHhX7glbb/fIcTVG8o9m4H1xD9d68/s5fUO8qS+uiWYtGXmLrIG9EpVHbIv1raIf7Pd 1m+BPi2eVhK1SLPYTwo4OPMKsM9Xq6aXv8X+qavoX+mIEFbI9UhMmmLQDTFnAGEDVZXu 1k08Gxp+14Hg1HbRwWnMe3XP7b/HfN2iABYd5HvtUgz9B72+wv23LLXtX4eYhjaxO5rB vg5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Z5AWohSIQN/10LPAph7pzNm6ZxTToaAIJFczhN/Pa+E=; b=XvxxUhuD0tvQNRx3geSGil7tH3DimCufKOUEcsJx1xeTamdAKWMAHbfCU1rHEZ9rc2 ypAL7Vr2v8WD3dxXdzbTw2nqJ9XvKsm0UXYX7t7eDssFX9D8WNFx03eHlbVQmcEvAVbg pLtEOz6V6Z75EeEpFAl5jCJ6wArLPVN+FG+5XSqtUJZiiIkjcNLm+NoQjKloxfYw6hwK gSHTCEXXP1ow0zutO+KbQwi+7enD+y0vy+BkwIRpdiFMX+3X130jLswobPTLpldqxmCd dwkNWDka1mU+pc8ORgpaZcPHZ8ZybDbBFzdQw2Br+hPdkGSwQBNIBoVFbWwSKVEmmtmf H77w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=blZfhzi+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z20si3525261ejb.342.2020.06.21.20.14.29; Sun, 21 Jun 2020 20:14:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=blZfhzi+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731186AbgFVDKk (ORCPT + 99 others); Sun, 21 Jun 2020 23:10:40 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:35978 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726559AbgFVDKj (ORCPT ); Sun, 21 Jun 2020 23:10:39 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05M3AYL3156552; Mon, 22 Jun 2020 03:10:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=Z5AWohSIQN/10LPAph7pzNm6ZxTToaAIJFczhN/Pa+E=; b=blZfhzi+2gWRAlKbpse8FO0ag3V/AcR4UdBHrU5YlLhO5C/XO2OqduP9jQNXaF/nQANB QhYYXSzWisWkmaQwYuhZJpTUeO7qQCqLPwKONcb2VCYBehtf7rirH/6omwkk2WLxmxdB liEKUtbxKkiTYku32AykzUnOhYaaKZy4gGkcDwNRCREiE9KqlAqEFXa5X7phbitGWLS2 mFy7A7z53HD12eeHew+Zd0RUlZUkC6nzatu9YJfrY/CSrhf3nlKdDQSzDJg1mJurwS9w eyD+hdoEg1DB4DdjBTA3wjH6akNX0jrUfNbFQD7IsS9AIdWfvga86ImV2u11KcTFLAbL SA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 31sebbc1g3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 22 Jun 2020 03:10:33 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05M37VPh088556; Mon, 22 Jun 2020 03:08:33 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 31sv1k30hn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Jun 2020 03:08:33 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 05M38V6o019381; Mon, 22 Jun 2020 03:08:31 GMT Received: from [192.168.0.110] (/183.246.145.120) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Jun 2020 03:08:31 +0000 Subject: Re: [PATCH 1/2] workqueue: don't always set __WQ_ORDERED implicitly To: linux-kernel@vger.kernel.org Cc: tj@kernel.org, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, open-iscsi@googlegroups.com, lduncan@suse.com, michael.christie@oracle.com References: <20200611100717.27506-1-bob.liu@oracle.com> From: Bob Liu Message-ID: Date: Mon, 22 Jun 2020 11:08:24 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200611100717.27506-1-bob.liu@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9659 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 suspectscore=1 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006220023 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9659 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 cotscore=-2147483648 mlxscore=0 phishscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 suspectscore=1 clxscore=1015 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006220023 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ping.. On 6/11/20 6:07 PM, Bob Liu wrote: > Current code always set 'Unbound && max_active == 1' workqueues to ordered > implicitly, while this may be not an expected behaviour for some use cases. > > E.g some scsi and iscsi workqueues(unbound && max_active = 1) want to be bind > to different cpu so as to get better isolation, but their cpumask can't be > changed because WQ_ORDERED is set implicitly. > > This patch adds a flag __WQ_ORDERED_DISABLE and also > create_singlethread_workqueue_noorder() to offer an new option. > > Signed-off-by: Bob Liu > --- > include/linux/workqueue.h | 4 ++++ > kernel/workqueue.c | 4 +++- > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h > index e48554e..4c86913 100644 > --- a/include/linux/workqueue.h > +++ b/include/linux/workqueue.h > @@ -344,6 +344,7 @@ enum { > __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */ > __WQ_LEGACY = 1 << 18, /* internal: create*_workqueue() */ > __WQ_ORDERED_EXPLICIT = 1 << 19, /* internal: alloc_ordered_workqueue() */ > + __WQ_ORDERED_DISABLE = 1 << 20, /* internal: don't set __WQ_ORDERED implicitly */ > > WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */ > WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */ > @@ -433,6 +434,9 @@ struct workqueue_struct *alloc_workqueue(const char *fmt, > #define create_singlethread_workqueue(name) \ > alloc_ordered_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, name) > > +#define create_singlethread_workqueue_noorder(name) \ > + alloc_workqueue("%s", WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | \ > + WQ_UNBOUND | __WQ_ORDERED_DISABLE, 1, (name)) > extern void destroy_workqueue(struct workqueue_struct *wq); > > struct workqueue_attrs *alloc_workqueue_attrs(void); > diff --git a/kernel/workqueue.c b/kernel/workqueue.c > index 4e01c44..2167013 100644 > --- a/kernel/workqueue.c > +++ b/kernel/workqueue.c > @@ -4237,7 +4237,9 @@ struct workqueue_struct *alloc_workqueue(const char *fmt, > * on NUMA. > */ > if ((flags & WQ_UNBOUND) && max_active == 1) > - flags |= __WQ_ORDERED; > + /* the caller may don't want __WQ_ORDERED to be set implicitly. */ > + if (!(flags & __WQ_ORDERED_DISABLE)) > + flags |= __WQ_ORDERED; > > /* see the comment above the definition of WQ_POWER_EFFICIENT */ > if ((flags & WQ_POWER_EFFICIENT) && wq_power_efficient) >