Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753481AbdLSRFz (ORCPT ); Tue, 19 Dec 2017 12:05:55 -0500 Received: from smtprelay0057.hostedemail.com ([216.40.44.57]:44235 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751949AbdLSRFq (ORCPT ); Tue, 19 Dec 2017 12:05:46 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:3874:4321:5007:6119:7576:7688:7903:10004:10400:10848:11026:11232:11658:11914:12048:12296:12740:12760:12895:13069:13141:13230:13311:13357:13439:14096:14097:14181:14659:14721:21080:21451:21627:30003:30051:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: unit51_14fc627cac80f X-Filterd-Recvd-Size: 2097 Message-ID: <1513703142.1234.53.camel@perches.com> Subject: Re: [PATCH 1/2] mm: Make follow_pte_pmd an inline From: Joe Perches To: Matthew Wilcox , linux-kernel@vger.kernel.org, Ross Zwisler , Dave Hansen , linux-mm@kvack.org, Josh Triplett Cc: Matthew Wilcox Date: Tue, 19 Dec 2017 09:05:42 -0800 In-Reply-To: <20171219165823.24243-1-willy@infradead.org> References: <20171219165823.24243-1-willy@infradead.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1175 Lines: 33 On Tue, 2017-12-19 at 08:58 -0800, Matthew Wilcox wrote: > From: Matthew Wilcox > > 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; > +}