Skip to contentSkip to conversation

cxl: don't manipulate the mm.mm_users field directly

PATCH Applied Laurent Dufour 4 participants 4 messages Mar 10, 2021 – Mar 31, 2021 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/misc/cxl/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/cxl/fault.c +1 -1
index 01153b74334a..60c829113299 100644
@@ -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;
Signature · 1 line
2.30.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Laurent Dufour

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

---

Thanks!

Quoted 17 lines
  drivers/misc/cxl/fault.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/cxl/fault.c +1 -1
index 01153b74334a..60c829113299 100644
@@ -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;