Re: [PATCH V4 1/3] livepatch: remove 'struct completion finish' from klp_patch

From: Miroslav Benes
Date: Mon Nov 08 2021 - 12:47:04 EST


On Tue, 2 Nov 2021, Ming Lei wrote:

> The completion finish is just for waiting release of the klp_patch
> object, then releases module refcnt. We can simply drop the module
> refcnt in the kobject release handler of klp_patch.
>
> This way also helps to support allocating klp_patch from heap.
>
> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
> ---
> include/linux/livepatch.h | 1 -
> kernel/livepatch/core.c | 12 +++---------
> 2 files changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
> index 2614247a9781..9712818997c5 100644
> --- a/include/linux/livepatch.h
> +++ b/include/linux/livepatch.h
> @@ -170,7 +170,6 @@ struct klp_patch {
> bool enabled;
> bool forced;
> struct work_struct free_work;
> - struct completion finish;
> };
>
> #define klp_for_each_object_static(patch, obj) \

Petr pointed out the main problem. I'll just add that if it comes to it,
you could also remove the inclusion of completion.h header file and a
description of finish struct member.

Miroslav