[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 6 Jun 2019 12:57:19 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: rcampbell@...dia.com
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
John Hubbard <jhubbard@...dia.com>,
Ira Weiny <ira.weiny@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Arnd Bergmann <arnd@...db.de>,
Balbir Singh <bsingharora@...il.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
Matthew Wilcox <willy@...radead.org>,
Souptick Joarder <jrdr.linux@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 2/5] mm/hmm: Clean up some coding style and comments
On Mon, May 06, 2019 at 04:29:39PM -0700, rcampbell@...dia.com wrote:
> @@ -924,6 +922,7 @@ int hmm_range_register(struct hmm_range *range,
> unsigned page_shift)
> {
> unsigned long mask = ((1UL << page_shift) - 1UL);
> + struct hmm *hmm;
>
> range->valid = false;
> range->hmm = NULL;
I was finishing these patches off and noticed that 'hmm' above is
never initialized.
I added the below to this patch:
diff --git a/mm/hmm.c b/mm/hmm.c
index 678873eb21930a..8e7403f081f44a 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -932,19 +932,20 @@ int hmm_range_register(struct hmm_range *range,
range->start = start;
range->end = end;
- range->hmm = hmm_get_or_create(mm);
- if (!range->hmm)
+ hmm = hmm_get_or_create(mm);
+ if (!hmm)
return -EFAULT;
/* Check if hmm_mm_destroy() was call. */
- if (range->hmm->mm == NULL || range->hmm->dead) {
- hmm_put(range->hmm);
+ if (hmm->mm == NULL || hmm->dead) {
+ hmm_put(hmm);
return -EFAULT;
}
/* Initialize range to track CPU page table updates. */
- mutex_lock(&range->hmm->lock);
+ mutex_lock(&hmm->lock);
+ range->hmm = hmm;
list_add_rcu(&range->list, &hmm->ranges);
/*
Which I think was the intent of adding the 'struct hmm *'. I prefer
this arrangement as it does not set an leave an invalid hmm pointer in
the range if there is a failure..
Most probably the later patches fixed this up?
Please confirm, thanks
Regards,
Jason
Powered by blists - more mailing lists