* [PATCH] completion: introduce complete_put() helper function
@ 2021-12-06 4:03 Yajun Deng
2021-12-06 7:17 ` kernel test robot
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Yajun Deng @ 2021-12-06 4:03 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot
Cc: dietmar.eggemann, rostedt, bsegall, mgorman, bristot,
linux-kernel, Yajun Deng
There are many cases where it is necessary to decrease refcount and test,
then called complete(). So introduce complete_put() helper function.
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
kernel/sched/completion.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c
index a778554f9dad..dcb737f1edc2 100644
--- a/kernel/sched/completion.c
+++ b/kernel/sched/completion.c
@@ -38,6 +38,13 @@ void complete(struct completion *x)
}
EXPORT_SYMBOL(complete);
+void complete_put(refcount_t *r, struct completion *x)
+{
+ if (refcount_dec_and_test(r))
+ complete(x);
+}
+EXPORT_SYMBOL(complete_put);
+
/**
* complete_all: - signals all threads waiting on this completion
* @x: holds the state of this particular completion
--
2.32.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] completion: introduce complete_put() helper function
2021-12-06 4:03 [PATCH] completion: introduce complete_put() helper function Yajun Deng
@ 2021-12-06 7:17 ` kernel test robot
2021-12-06 7:37 ` kernel test robot
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-12-06 7:17 UTC (permalink / raw)
To: Yajun Deng, mingo, juri.lelli, vincent.guittot
Cc: llvm, kbuild-all, dietmar.eggemann, rostedt, bsegall, mgorman,
bristot, linux-kernel
Hi Yajun,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on tip/sched/core]
[also build test WARNING on v5.16-rc4 next-20211203]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Yajun-Deng/completion-introduce-complete_put-helper-function/20211206-120632
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 8c92606ab81086db00cbb73347d124b4eb169b7e
config: hexagon-randconfig-r031-20211206 (https://download.01.org/0day-ci/archive/20211206/202112061502.0pJtOzSU-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project f50be8eb0a12a61d23db6cda452c693001d76898)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/6d181628873250fd66a8f2da19182fec95973b6e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yajun-Deng/completion-introduce-complete_put-helper-function/20211206-120632
git checkout 6d181628873250fd66a8f2da19182fec95973b6e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash kernel/sched/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> kernel/sched/completion.c:41:6: warning: no previous prototype for function 'complete_put' [-Wmissing-prototypes]
void complete_put(refcount_t *r, struct completion *x)
^
kernel/sched/completion.c:41:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void complete_put(refcount_t *r, struct completion *x)
^
static
1 warning generated.
vim +/complete_put +41 kernel/sched/completion.c
40
> 41 void complete_put(refcount_t *r, struct completion *x)
42 {
43 if (refcount_dec_and_test(r))
44 complete(x);
45 }
46 EXPORT_SYMBOL(complete_put);
47
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] completion: introduce complete_put() helper function
2021-12-06 4:03 [PATCH] completion: introduce complete_put() helper function Yajun Deng
2021-12-06 7:17 ` kernel test robot
@ 2021-12-06 7:37 ` kernel test robot
2021-12-06 8:34 ` Peter Zijlstra
2021-12-06 9:13 ` yajun.deng
3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-12-06 7:37 UTC (permalink / raw)
To: Yajun Deng, mingo, juri.lelli, vincent.guittot
Cc: kbuild-all, dietmar.eggemann, rostedt, bsegall, mgorman, bristot,
linux-kernel
Hi Yajun,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on tip/sched/core]
[also build test WARNING on v5.16-rc4 next-20211203]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Yajun-Deng/completion-introduce-complete_put-helper-function/20211206-120632
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 8c92606ab81086db00cbb73347d124b4eb169b7e
config: arm-randconfig-r033-20211206 (https://download.01.org/0day-ci/archive/20211206/202112061552.NaaSG9xz-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/6d181628873250fd66a8f2da19182fec95973b6e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yajun-Deng/completion-introduce-complete_put-helper-function/20211206-120632
git checkout 6d181628873250fd66a8f2da19182fec95973b6e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash kernel/sched/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> kernel/sched/completion.c:41:6: warning: no previous prototype for 'complete_put' [-Wmissing-prototypes]
41 | void complete_put(refcount_t *r, struct completion *x)
| ^~~~~~~~~~~~
vim +/complete_put +41 kernel/sched/completion.c
40
> 41 void complete_put(refcount_t *r, struct completion *x)
42 {
43 if (refcount_dec_and_test(r))
44 complete(x);
45 }
46 EXPORT_SYMBOL(complete_put);
47
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] completion: introduce complete_put() helper function
2021-12-06 4:03 [PATCH] completion: introduce complete_put() helper function Yajun Deng
2021-12-06 7:17 ` kernel test robot
2021-12-06 7:37 ` kernel test robot
@ 2021-12-06 8:34 ` Peter Zijlstra
2021-12-06 9:13 ` yajun.deng
3 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2021-12-06 8:34 UTC (permalink / raw)
To: Yajun Deng
Cc: mingo, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt,
bsegall, mgorman, bristot, linux-kernel
On Mon, Dec 06, 2021 at 12:03:19PM +0800, Yajun Deng wrote:
> There are many cases where it is necessary to decrease refcount and test,
> then called complete(). So introduce complete_put() helper function.
>
> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
> ---
> kernel/sched/completion.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c
> index a778554f9dad..dcb737f1edc2 100644
> --- a/kernel/sched/completion.c
> +++ b/kernel/sched/completion.c
> @@ -38,6 +38,13 @@ void complete(struct completion *x)
> }
> EXPORT_SYMBOL(complete);
>
> +void complete_put(refcount_t *r, struct completion *x)
> +{
> + if (refcount_dec_and_test(r))
> + complete(x);
> +}
> +EXPORT_SYMBOL(complete_put);
Please submit such things as part of the series that makes use of them.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] completion: introduce complete_put() helper function
2021-12-06 4:03 [PATCH] completion: introduce complete_put() helper function Yajun Deng
` (2 preceding siblings ...)
2021-12-06 8:34 ` Peter Zijlstra
@ 2021-12-06 9:13 ` yajun.deng
3 siblings, 0 replies; 5+ messages in thread
From: yajun.deng @ 2021-12-06 9:13 UTC (permalink / raw)
To: Peter Zijlstra
Cc: mingo, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt,
bsegall, mgorman, bristot, linux-kernel
December 6, 2021 4:34 PM, "Peter Zijlstra" <peterz@infradead.org> wrote:
> On Mon, Dec 06, 2021 at 12:03:19PM +0800, Yajun Deng wrote:
>
>> There are many cases where it is necessary to decrease refcount and test,
>> then called complete(). So introduce complete_put() helper function.
>>
>> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
>> ---
>> kernel/sched/completion.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c
>> index a778554f9dad..dcb737f1edc2 100644
>> --- a/kernel/sched/completion.c
>> +++ b/kernel/sched/completion.c
>> @@ -38,6 +38,13 @@ void complete(struct completion *x)
>> }
>> EXPORT_SYMBOL(complete);
>>
>> +void complete_put(refcount_t *r, struct completion *x)
>> +{
>> + if (refcount_dec_and_test(r))
>> + complete(x);
>> +}
>> +EXPORT_SYMBOL(complete_put);
>
> Please submit such things as part of the series that makes use of them.
Here is a typical use case: vim drivers/infiniband/core/device.c +101
static void ib_client_put(struct ib_client *client)
{
if (refcount_dec_and_test(&client->uses))
complete(&client->uses_zero);
}
Each driver needs to define a xxx_put() function if they want to use it, we can add this helper function for them.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-06 9:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 4:03 [PATCH] completion: introduce complete_put() helper function Yajun Deng
2021-12-06 7:17 ` kernel test robot
2021-12-06 7:37 ` kernel test robot
2021-12-06 8:34 ` Peter Zijlstra
2021-12-06 9:13 ` yajun.deng
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).