[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1513703142.1234.53.camel@perches.com>
Date: Tue, 19 Dec 2017 09:05:42 -0800
From: Joe Perches <joe@...ches.com>
To: Matthew Wilcox <willy@...radead.org>, linux-kernel@...r.kernel.org,
Ross Zwisler <ross.zwisler@...ux.intel.com>,
Dave Hansen <dave.hansen@...el.com>, linux-mm@...ck.org,
Josh Triplett <josh@...htriplett.org>
Cc: Matthew Wilcox <mawilcox@...rosoft.com>
Subject: Re: [PATCH 1/2] mm: Make follow_pte_pmd an inline
On Tue, 2017-12-19 at 08:58 -0800, Matthew Wilcox wrote:
> From: Matthew Wilcox <mawilcox@...rosoft.com>
>
> The one user of follow_pte_pmd (dax) emits a sparse warning because
> it doesn't know that follow_pte_pmd conditionally returns with the
> pte/pmd locked. The required annotation is already there; it's just
> in the wrong file.
[]
> diff --git a/include/linux/mm.h b/include/linux/mm.h
[]
> @@ -1324,6 +1324,19 @@ int follow_phys(struct vm_area_struct *vma, unsigned long address,
> int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
> void *buf, int len, int write);
>
> +static inline int follow_pte_pmd(struct mm_struct *mm, unsigned long address,
> + unsigned long *start, unsigned long *end,
> + pte_t **ptepp, pmd_t **pmdpp, spinlock_t **ptlp)
> +{
> + int res;
> +
> + /* (void) is needed to make gcc happy */
> + (void) __cond_lock(*ptlp,
> + !(res = __follow_pte_pmd(mm, address, start, end,
> + ptepp, pmdpp, ptlp)));
This seems obscure and difficult to read. Perhaps:
res = __follow_pte_pmd(mm, address, start, end, ptepp, pmdpp, ptlp);
(void)__cond_lock(*ptlp, !res);
> + return res;
> +}
Powered by blists - more mailing lists