2021-03-10 17:46:51

by Laurent Dufour

[permalink] [raw]
Subject: [PATCH] cxl: don't manipulate the mm.mm_users field directly

It is better to rely on the API provided by the MM layer instead of
directly manipulating the mm_users field.

Signed-off-by: Laurent Dufour <[email protected]>
---
drivers/misc/cxl/fault.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c
index 01153b74334a..60c829113299 100644
--- a/drivers/misc/cxl/fault.c
+++ b/drivers/misc/cxl/fault.c
@@ -200,7 +200,7 @@ static struct mm_struct *get_mem_context(struct cxl_context *ctx)
if (ctx->mm == NULL)
return NULL;

- if (!atomic_inc_not_zero(&ctx->mm->mm_users))
+ if (!mmget_not_zero(ctx->mm))
return NULL;

return ctx->mm;
--
2.30.1


2021-03-11 07:48:32

by Frederic Barrat

[permalink] [raw]
Subject: Re: [PATCH] cxl: don't manipulate the mm.mm_users field directly



On 10/03/2021 18:44, Laurent Dufour wrote:
> It is better to rely on the API provided by the MM layer instead of
> directly manipulating the mm_users field.
>
> Signed-off-by: Laurent Dufour <[email protected]>
> ---


Thanks!
Acked-by: Frederic Barrat <[email protected]>



> drivers/misc/cxl/fault.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c
> index 01153b74334a..60c829113299 100644
> --- a/drivers/misc/cxl/fault.c
> +++ b/drivers/misc/cxl/fault.c
> @@ -200,7 +200,7 @@ static struct mm_struct *get_mem_context(struct cxl_context *ctx)
> if (ctx->mm == NULL)
> return NULL;
>
> - if (!atomic_inc_not_zero(&ctx->mm->mm_users))
> + if (!mmget_not_zero(ctx->mm))
> return NULL;
>
> return ctx->mm;
>

2021-03-12 02:20:21

by Andrew Donnellan

[permalink] [raw]
Subject: Re: [PATCH] cxl: don't manipulate the mm.mm_users field directly

On 11/3/21 4:44 am, Laurent Dufour wrote:
> It is better to rely on the API provided by the MM layer instead of
> directly manipulating the mm_users field.
>
> Signed-off-by: Laurent Dufour <[email protected]>

LGTM, thanks for picking this up

Acked-by: Andrew Donnellan <[email protected]>


--
Andrew Donnellan OzLabs, ADL Canberra
[email protected] IBM Australia Limited

2021-03-31 01:12:49

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH] cxl: don't manipulate the mm.mm_users field directly

On Wed, 10 Mar 2021 18:44:05 +0100, Laurent Dufour wrote:
> It is better to rely on the API provided by the MM layer instead of
> directly manipulating the mm_users field.

Applied to powerpc/next.

[1/1] cxl: don't manipulate the mm.mm_users field directly
https://git.kernel.org/powerpc/c/2d9f69bc5a5a75579b410beb0dc3d313be762c9f

cheers