[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3a91e9a7-e533-863b-ee5f-c34f1e10433c@nvidia.com>
Date: Thu, 6 Jun 2019 17:44:15 -0700
From: Ralph Campbell <rcampbell@...dia.com>
To: Jason Gunthorpe <jgg@...pe.ca>
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 6/6/19 8:57 AM, Jason Gunthorpe wrote:
> 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
>
Yes, you understand correctly. That was the intended clean up.
I must have split my original patch set incorrectly.
Powered by blists - more mailing lists