* [PATCH] workqueue: Use IS_ERR and PTR_ERR instead of PTR_ERR_OR_ZERO to remove redundant definitions and checks.
@ 2020-04-29 2:19 Sean Fu
2020-04-29 4:04 ` [PATCH v2] workqueue: Use IS_ERR and PTR_ERR instead of PTR_ERR_OR_ZERO Sean Fu
0 siblings, 1 reply; 3+ messages in thread
From: Sean Fu @ 2020-04-29 2:19 UTC (permalink / raw)
To: tj; +Cc: jiangshanlai, linux-kernel, Sean Fu
Reduce code size.
Before:
text data bss dec hex filename
47510 5979 840 54329 d439 kernel/workqueue.o
After:
text data bss dec hex filename
47474 5979 840 54293 d415 kernel/workqueue.o
Signed-off-by: Sean Fu <fxinrong@gmail.com>
---
kernel/workqueue.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 891ccad5f271..ddf0537dce14 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4197,7 +4197,6 @@ static int wq_clamp_max_active(int max_active, unsigned int flags,
static int init_rescuer(struct workqueue_struct *wq)
{
struct worker *rescuer;
- int ret;
if (!(wq->flags & WQ_MEM_RECLAIM))
return 0;
@@ -4208,10 +4207,9 @@ static int init_rescuer(struct workqueue_struct *wq)
rescuer->rescue_wq = wq;
rescuer->task = kthread_create(rescuer_thread, rescuer, "%s", wq->name);
- ret = PTR_ERR_OR_ZERO(rescuer->task);
- if (ret) {
+ if (IS_ERR(rescuer->task)) {
kfree(rescuer);
- return ret;
+ return PTR_ERR(rescuer->task);
}
wq->rescuer = rescuer;
--
2.16.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2] workqueue: Use IS_ERR and PTR_ERR instead of PTR_ERR_OR_ZERO.
2020-04-29 2:19 [PATCH] workqueue: Use IS_ERR and PTR_ERR instead of PTR_ERR_OR_ZERO to remove redundant definitions and checks Sean Fu
@ 2020-04-29 4:04 ` Sean Fu
2020-05-05 15:56 ` Tejun Heo
0 siblings, 1 reply; 3+ messages in thread
From: Sean Fu @ 2020-04-29 4:04 UTC (permalink / raw)
To: tj; +Cc: jiangshanlai, linux-kernel, Sean Fu
Replace inline function PTR_ERR_OR_ZERO with IS_ERR and PTR_ERR to
remove redundant parameter definitions and checks.
Reduce code size.
Before:
text data bss dec hex filename
47510 5979 840 54329 d439 kernel/workqueue.o
After:
text data bss dec hex filename
47474 5979 840 54293 d415 kernel/workqueue.o
Signed-off-by: Sean Fu <fxinrong@gmail.com>
---
Changes in v2:
- make commit message more clear.
kernel/workqueue.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 891ccad5f271..ddf0537dce14 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4197,7 +4197,6 @@ static int wq_clamp_max_active(int max_active, unsigned int flags,
static int init_rescuer(struct workqueue_struct *wq)
{
struct worker *rescuer;
- int ret;
if (!(wq->flags & WQ_MEM_RECLAIM))
return 0;
@@ -4208,10 +4207,9 @@ static int init_rescuer(struct workqueue_struct *wq)
rescuer->rescue_wq = wq;
rescuer->task = kthread_create(rescuer_thread, rescuer, "%s", wq->name);
- ret = PTR_ERR_OR_ZERO(rescuer->task);
- if (ret) {
+ if (IS_ERR(rescuer->task)) {
kfree(rescuer);
- return ret;
+ return PTR_ERR(rescuer->task);
}
wq->rescuer = rescuer;
--
2.16.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] workqueue: Use IS_ERR and PTR_ERR instead of PTR_ERR_OR_ZERO.
2020-04-29 4:04 ` [PATCH v2] workqueue: Use IS_ERR and PTR_ERR instead of PTR_ERR_OR_ZERO Sean Fu
@ 2020-05-05 15:56 ` Tejun Heo
0 siblings, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2020-05-05 15:56 UTC (permalink / raw)
To: Sean Fu; +Cc: jiangshanlai, linux-kernel
On Wed, Apr 29, 2020 at 12:04:13PM +0800, Sean Fu wrote:
> Replace inline function PTR_ERR_OR_ZERO with IS_ERR and PTR_ERR to
> remove redundant parameter definitions and checks.
> Reduce code size.
> Before:
> text data bss dec hex filename
> 47510 5979 840 54329 d439 kernel/workqueue.o
> After:
> text data bss dec hex filename
> 47474 5979 840 54293 d415 kernel/workqueue.o
>
> Signed-off-by: Sean Fu <fxinrong@gmail.com>
Applied to wq/for-5.8.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-05 15:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 2:19 [PATCH] workqueue: Use IS_ERR and PTR_ERR instead of PTR_ERR_OR_ZERO to remove redundant definitions and checks Sean Fu
2020-04-29 4:04 ` [PATCH v2] workqueue: Use IS_ERR and PTR_ERR instead of PTR_ERR_OR_ZERO Sean Fu
2020-05-05 15:56 ` Tejun Heo
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).