From patchwork Thu Apr 2 04:06:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 11469899 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9ACA192A for ; Thu, 2 Apr 2020 04:06:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5EA3B2074D for ; Thu, 2 Apr 2020 04:06:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="spjrBZtr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5EA3B2074D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 504728E0033; Thu, 2 Apr 2020 00:06:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4B4B08E000D; Thu, 2 Apr 2020 00:06:03 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3CAB98E0033; Thu, 2 Apr 2020 00:06:03 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id 2281B8E000D for ; Thu, 2 Apr 2020 00:06:03 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id DA6A93A97 for ; Thu, 2 Apr 2020 04:06:02 +0000 (UTC) X-FDA: 76661576964.27.song91_34c2361a68360 X-Spam-Summary: 2,0,0,f2c19ef25d6e4c74,d41d8cd98f00b204,akpm@linux-foundation.org,,RULES_HIT:41:69:355:379:800:960:967:973:988:989:1260:1263:1345:1359:1381:1431:1437:1534:1542:1711:1730:1747:1777:1792:2393:2525:2559:2563:2682:2685:2859:2902:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4605:5007:6119:6261:6653:6737:7514:7576:7901:7903:9025:9391:9545:10004:10913:11026:11473:11658:11914:12043:12048:12114:12296:12297:12438:12517:12519:12555:12679:12783:12986:13846:14096:14181:14721:14849:21080:21433:21451:21627:21819:21939:21990:30012:30045:30054:30064,0,RBL:198.145.29.99:@linux-foundation.org:.lbl8.mailshell.net-64.100.201.201 62.2.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:16,LUA_SUMMARY:none X-HE-Tag: song91_34c2361a68360 X-Filterd-Recvd-Size: 4489 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Apr 2020 04:06:02 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 254A42078E; Thu, 2 Apr 2020 04:06:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585800361; bh=wMKdYrvaoV8PFvR+pFM08SO/gLaxyCF6PBpuxJj3rTs=; h=Date:From:To:Subject:In-Reply-To:From; b=spjrBZtrut5lHwhxQTRWMP54DmugxAOoWeHrulhHolQBt4F23fzfXkljBwBZaen12 q7+JOlTWw1PautLTl+ADybuYKyeEnZ/UHZeLjS6pVEIjE7RlIN84rWhJcR7c+1dHZq kyOgaOxEt6N56jSqoFJ1h6Cz5nQqW436xads9xJQ= Date: Wed, 01 Apr 2020 21:06:00 -0700 From: Andrew Morton To: akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, dan.j.williams@intel.com, hch@infradead.org, ira.weiny@intel.com, jgg@ziepe.ca, jhubbard@nvidia.com, kernelfans@gmail.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, rppt@linux.ibm.com, shuah@kernel.org, torvalds@linux-foundation.org, willy@infradead.org Subject: [patch 051/155] mm/gup: rename nr as nr_pinned in get_user_pages_fast() Message-ID: <20200402040600.xL2phtTi9%akpm@linux-foundation.org> In-Reply-To: <20200401210155.09e3b9742e1c6e732f5a7250@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Pingfan Liu Subject: mm/gup: rename nr as nr_pinned in get_user_pages_fast() To better reflect the held state of pages and make code self-explaining, rename nr as nr_pinned. Link: http://lkml.kernel.org/r/1584876733-17405-2-git-send-email-kernelfans@gmail.com Signed-off-by: Pingfan Liu Reviewed-by: John Hubbard Cc: Ira Weiny Cc: Mike Rapoport Cc: Dan Williams Cc: Matthew Wilcox Cc: "Aneesh Kumar K.V" Cc: Christoph Hellwig Cc: Shuah Khan Cc: Jason Gunthorpe Signed-off-by: Andrew Morton --- mm/gup.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) --- a/mm/gup.c~mm-gup-rename-nr-as-nr_pinned-in-get_user_pages_fast +++ a/mm/gup.c @@ -2637,7 +2637,7 @@ int __get_user_pages_fast(unsigned long { unsigned long len, end; unsigned long flags; - int nr = 0; + int nr_pinned = 0; /* * Internally (within mm/gup.c), gup fast variants must set FOLL_GET, * because gup fast is always a "pin with a +1 page refcount" request. @@ -2671,11 +2671,11 @@ int __get_user_pages_fast(unsigned long if (IS_ENABLED(CONFIG_HAVE_FAST_GUP) && gup_fast_permitted(start, end)) { local_irq_save(flags); - gup_pgd_range(start, end, gup_flags, pages, &nr); + gup_pgd_range(start, end, gup_flags, pages, &nr_pinned); local_irq_restore(flags); } - return nr; + return nr_pinned; } EXPORT_SYMBOL_GPL(__get_user_pages_fast); @@ -2707,7 +2707,7 @@ static int internal_get_user_pages_fast( struct page **pages) { unsigned long addr, len, end; - int nr = 0, ret = 0; + int nr_pinned = 0, ret = 0; if (WARN_ON_ONCE(gup_flags & ~(FOLL_WRITE | FOLL_LONGTERM | FOLL_FORCE | FOLL_PIN | FOLL_GET))) @@ -2726,25 +2726,25 @@ static int internal_get_user_pages_fast( if (IS_ENABLED(CONFIG_HAVE_FAST_GUP) && gup_fast_permitted(start, end)) { local_irq_disable(); - gup_pgd_range(addr, end, gup_flags, pages, &nr); + gup_pgd_range(addr, end, gup_flags, pages, &nr_pinned); local_irq_enable(); - ret = nr; + ret = nr_pinned; } - if (nr < nr_pages) { + if (nr_pinned < nr_pages) { /* Try to get the remaining pages with get_user_pages */ - start += nr << PAGE_SHIFT; - pages += nr; + start += nr_pinned << PAGE_SHIFT; + pages += nr_pinned; - ret = __gup_longterm_unlocked(start, nr_pages - nr, + ret = __gup_longterm_unlocked(start, nr_pages - nr_pinned, gup_flags, pages); /* Have to be a bit careful with return values */ - if (nr > 0) { + if (nr_pinned > 0) { if (ret < 0) - ret = nr; + ret = nr_pinned; else - ret += nr; + ret += nr_pinned; } }