Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2196760ybh; Sun, 15 Mar 2020 21:37:13 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvjnFAVYYMadOLHLLD4PLnMipM8poaOV6ufNtWkyUnkd3zkgf7Kqi9VazqvaG6Y5RDK7gAP X-Received: by 2002:a05:6830:1aca:: with SMTP id r10mr19555476otc.330.1584333433196; Sun, 15 Mar 2020 21:37:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584333433; cv=none; d=google.com; s=arc-20160816; b=eSh0OmZmu1vqyRo1AW45+ElDMyFttTImDH0cTRxhJbHHD3BjmqkMbfNigDcAbqLfP+ 0YUeXZCFbqUKCJLfi/17+mnj5/vuqhkorogNl2+qDtNvmHSKXHLfLG7pBemvaZ/+5php m+Qu1wCNSR69tKfwttyLVV0lwD4d7Ol4bsAvo0GSCY+b/r6R1hMk/Zlm/RgQeSnAVokg x5bi1BTIlgzr7t02tuygTAszDKREBJ0wsLWa5k8HSQg7XiIczMJzFiPkEaOgUIn9Pf4D q0OlLnKxwLwZuWhepj5cd7VZ+Fd9EOOk4m6HME+c1o4CgkgvA7ITDlFOz6xRjU0/DJ55 ORmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=j66a3s2vP+w20zjNn6qkww1MfEJEICNJLq9xqeevnk8=; b=FcYY3sQNfxS5JccfHPNlLve8YuJWaYBQ6E/FvJFzBZP3QBC3fVk10w25V4w5mwSn+z mOh89vueqEgdlMw5ao0TDuWkT4hlDI/ARCNqLf0k/6x14/4w9qqANXYiaxpwdgVP9e88 sE7XGbR6MUpEQgpwXPenzBggkG82XeqzaggFh+5QVJXs7WiiGOrxnI7/i7UwP6tghcOJ e3m9rOJsM2j60nP+K7vA0/iC7u3rxj/fYsRiUQ2KZYpJMa/AGmWEH7dqZsfyZfjmyAul ZipMLzNCeYuhxtBWHVCAy/ksC5xEAANbhfMLZIGs2ZGUYP5VJsqas95dhgFCjfipCe1J wI+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GgMs7KE+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i19si163413oie.253.2020.03.15.21.36.59; Sun, 15 Mar 2020 21:37:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GgMs7KE+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729610AbgCPEgd (ORCPT + 99 others); Mon, 16 Mar 2020 00:36:33 -0400 Received: from mail-pj1-f67.google.com ([209.85.216.67]:40623 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729423AbgCPEgd (ORCPT ); Mon, 16 Mar 2020 00:36:33 -0400 Received: by mail-pj1-f67.google.com with SMTP id bo3so6489701pjb.5 for ; Sun, 15 Mar 2020 21:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=j66a3s2vP+w20zjNn6qkww1MfEJEICNJLq9xqeevnk8=; b=GgMs7KE+x7u8c2D1GUcSwQOaBOyBlSMcZh5+Zn/Cql877d/Xa4BZnVC74rImQcQiza Pjnrm00Yp6zqwWC3w2/H1a0x2TlmcFf6UZI5ojLNAK2eP9KZZRMpTOtr5OMS+LI/DD0F Fbl+zMVmgP1Xq/QUOsChOQ09GEFcvynpnHOfFBjXpt7Ou38fRLiO6IPtSBF+3R0W2lJG KOxjEbXfq8L92hrL0DGarzOrB2FewqwrgURQDjTMF8EIo/L186+MMzbRmWVVF5ShYPT8 8r+fvm8XYIPuIHf6lrJQnrh/ODW7LBhBISWzabqdzXHnZhnvh37WMl+J1YB9lEGqYheY ox+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=j66a3s2vP+w20zjNn6qkww1MfEJEICNJLq9xqeevnk8=; b=eTLj8xReAFX9XYCpX2nTirefJpoPCkAfvEATRnnM/E91784yHNDMrwg1BdVGJRnwgi 3kS26TcHkphe860+2Kw6Y1/N8wxBkxRMtggyl+z9/Ydy8BGog4O4OkTByAkrheb27bJO JtoSlo7BP9DtxvQ+qNMqeyify2duOPK6B55y65Oyye/kayAj2rCosvorWO100MSZY8if 67xMq188y5PiDk/OyRlCSj5qLkjV3bTz8v7nuCFHZoNpa8CRX2NfPgmHPk6FHs/yCQe6 djr4qIG5zd6ItKOZ/c0SRLg0OYRYxaYC+MLxPY1c+O0krhbNP/sA1wI/hUotU/Saej6I vM4Q== X-Gm-Message-State: ANhLgQ2UbGbET/JmTlBaNBtNJDmVvZp0XuTP9cOSb7Ve127WDstZq1Uz 7KvHRwrBOAHZqERPoYIIDQ== X-Received: by 2002:a17:902:ab95:: with SMTP id f21mr22712206plr.188.1584333390348; Sun, 15 Mar 2020 21:36:30 -0700 (PDT) Received: from mylaptop.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id d6sm18544296pjz.39.2020.03.15.21.36.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Mar 2020 21:36:29 -0700 (PDT) From: Pingfan Liu To: linux-mm@kvack.org Cc: Pingfan Liu , Ira Weiny , Andrew Morton , Mike Rapoport , Dan Williams , Matthew Wilcox , John Hubbard , "Aneesh Kumar K.V" , Christoph Hellwig , Shuah Khan , linux-kernel@vger.kernel.org Subject: [PATCHv6 1/3] mm/gup: rename nr as nr_pinned in get_user_pages_fast() Date: Mon, 16 Mar 2020 12:34:02 +0800 Message-Id: <1584333244-10480-2-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1584333244-10480-1-git-send-email-kernelfans@gmail.com> References: <1584333244-10480-1-git-send-email-kernelfans@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To better reflect the held state of pages and make code self-explaining, rename nr as nr_pinned. Signed-off-by: Pingfan Liu Cc: Ira Weiny Cc: Andrew Morton Cc: Mike Rapoport Cc: Dan Williams Cc: Matthew Wilcox Cc: John Hubbard Cc: "Aneesh Kumar K.V" Cc: Christoph Hellwig Cc: Shuah Khan To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/gup.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index e8aaa40..9df77b1 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2735,7 +2735,7 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages, 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))) @@ -2754,25 +2754,25 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages, 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; } } -- 2.7.5