From patchwork Tue Sep 25 02:14:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 10613229 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ABA48913 for ; Tue, 25 Sep 2018 02:15:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94AC02A0CC for ; Tue, 25 Sep 2018 02:15:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83C9C2A19D; Tue, 25 Sep 2018 02:15:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C6F12A0CC for ; Tue, 25 Sep 2018 02:15:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 067E38E0058; Mon, 24 Sep 2018 22:15:00 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0177A8E0041; Mon, 24 Sep 2018 22:14:59 -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 E49B18E0058; Mon, 24 Sep 2018 22:14:59 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by kanga.kvack.org (Postfix) with ESMTP id A45A48E0041 for ; Mon, 24 Sep 2018 22:14:59 -0400 (EDT) Received: by mail-pf1-f198.google.com with SMTP id e15-v6so11344253pfi.5 for ; Mon, 24 Sep 2018 19:14:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=5+HREtS6bq64QaOSu9uqP3vWbLpxeFC8wjd26RYtjkI=; b=Izl0fboIZNgQuEJs9XcuWMpAUW/vA2YhmhezxB1OkEUwjdMEVhY4Zu6XYbg8egEovB wwxAF7nK3lPmeMc0VnMbkkZPMTnqAsLjtrGABpiacJF1Ha5Eq5CO/JmiMakCBR0ryFpV zkchHehfKtE1/KXEhLZ5eG81QZq/vmRHyRRXZ0SBw+C3yBdUSjarjed3HEh7epfA2pxx nYn45PCK8+ibQEysy/qrM8RikvDgJshXca8uS0nUYVRDxsYH94KR8Kjr3JOe8KRhJhAa m+tboxE/QL0kDNqAd8dGoQodOGZ2ttSGFOGDHoZlt6e3rIpdePbITxndUB4YUnrucB5Q x1Gw== X-Gm-Message-State: ABuFfojNuDiSp0OIr7JxaYV2S3SQ1NdxGs2LxtdAsLWAF5vZtoz4qGWI q3UpEp8As+5/2voKWIT02qNEszvAu5IdFeDg//eRcnxWOeTi8XFBEzVkYzXLvBVkw9gbGBohBb0 CL9ViRhHJmhGlWhEjUmpJv8o4pd5WzKtLS1qcRQeqtFgkDcuGa3x0hTV7cW2T+PycWjQJs3XAgo kZuu85MeH2r/3OTAxb06ghGlqWph6VD5zECEljBoMdonJw+p6hQJxdaNEHvNKTqiJXCeR/lCUmJ 0DzwirBDAQoJJy8tB2wtfABogsZqS4AYnv+PNCE5hBH5Ynm/qhbdjlnlFuw9iMMRGjuuB6SnApY N6okAwVUCBx/eTCPNVpr1S/cg7Q1XnIOzHPeiGlo4TmOU4+Dlv82o2Lj3bLV1DrB0kKXXcSFnMA V X-Received: by 2002:a65:40cd:: with SMTP id u13-v6mr1195948pgp.334.1537841699310; Mon, 24 Sep 2018 19:14:59 -0700 (PDT) X-Received: by 2002:a65:40cd:: with SMTP id u13-v6mr1195908pgp.334.1537841698328; Mon, 24 Sep 2018 19:14:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537841698; cv=none; d=google.com; s=arc-20160816; b=WnFybcXaJYiTwksZIOiBZQR9I/dghbQBdQSk4EcohgnzIXOrXcHZsok6cGRNNiAThQ VZcoH6YoIju3lTVhApH4IdaIqZriPVwcjBJb6DZbd5tKQZa9TcN607wsPH0a/iXi0drc wfDvbru8Utbxz9SVtVk02LGjq0eWxIvBaDF42p3301BFgRsY1RkQoL0k9jQYiCR44Rx3 ytD+MfA42QbCuYkZ9R6WZ+v6MznXhSWOKsDqMYqfE6+7XbBEtgGpfU0usCM3yGE1qhbJ w5nIRvLfS/pLuXq+5iiotYH92Ukzq4rmhfUCg8qK1RkQamPODDxG6yj0njVUcLogMrXP 6Bgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=5+HREtS6bq64QaOSu9uqP3vWbLpxeFC8wjd26RYtjkI=; b=yHdjIxB1TqPOu8OIkWBdgS77vLcmGOVf3u3NASAR3i6quAaBh0IoUMUlkDACGBXk/z 0WGobyey7rPvXP1b9XeLx+wJun0Nkucvq2Zl6v9xQJHJ/+kJljQqMGNCcvrPm7YGkcAe zuNVDGsBQPGzp2ms47jbSOG1bqEkPMMJtKDRYylX20ChXT5xJQ87SzjSehYzak/fWTsy r3Npq9Fcjj8ShilGhS48NMPI7//1cO3dtZgMJT6L9N9Ye0G3bpZ0QLx/iMF1Z0cSCElK R9xHfwlt900z7CZwlavUnFquyUSQ5gGU+3Pey3K0YC1M1DlmqY5L6CMZil4UZNLi1sFX X2bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JBxl3661; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id q36-v6sor114741pgl.248.2018.09.24.19.14.58 for (Google Transport Security); Mon, 24 Sep 2018 19:14:58 -0700 (PDT) Received-SPF: pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JBxl3661; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=5+HREtS6bq64QaOSu9uqP3vWbLpxeFC8wjd26RYtjkI=; b=JBxl3661drGZEU2b28jX6z/fhmoG/9l0wGiQ50ucOwJGjcvLHlXQj2MPgVnS6N8Skc NL5AGbR6VPNw0uA7cl2LzNgatfw6lG7YnC+PMSuaDlmfCtRfkXSnUqH9XsGHxNM4CDlp RRsBg+xvbvyh4qox7qSjSbAg1Y0z8AHgR3bocQDS4F/iivIw0qz4zX91PJFMQ+WLYZYA XOR2rQAflhBMgUoP8cgkSGHIxoggGB8WPL68bddWJGfm+pbkLIJ7MNnQ/r3lzivYO1Pn Lw1WcIdtof+vHjEpzqpKjWLcWvodYx+GQcU3Inx1r3U7KVWBBkEA0mUI8EWK1a2T9P/H Rdvw== X-Google-Smtp-Source: ACcGV63/RQFTOEL2x2esBSII1no1Fl+Chtc+KyGkvUXqUYOtP4GRNZensYGjKuyuu3631xebuTnr+Q== X-Received: by 2002:a63:77ce:: with SMTP id s197-v6mr1253423pgc.172.1537841697827; Mon, 24 Sep 2018 19:14:57 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id n80-v6sm853803pfh.166.2018.09.24.19.14.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Sep 2018 19:14:57 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, dan.j.williams@intel.com Cc: linux-mm@kvack.org, Wei Yang Subject: [PATCH] mm: remove unnecessary local variable addr in __get_user_pages_fast() Date: Tue, 25 Sep 2018 10:14:48 +0800 Message-Id: <20180925021448.20265-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.15.1 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: X-Virus-Scanned: ClamAV using ClamSMTP The local variable *addr* in __get_user_pages_fast() is just a shadow of *start*. Since *start* never changes after assigned to *addr*, it is fine to replace *start* with it. Also the meaning of [start, end] is more obvious than [addr, end] when passed to gup_pgd_range(). Signed-off-by: Wei Yang --- mm/gup.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index fc5f98069f4e..1a80775440cb 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1780,12 +1780,11 @@ bool gup_fast_permitted(unsigned long start, int nr_pages, int write) int __get_user_pages_fast(unsigned long start, int nr_pages, int write, struct page **pages) { - unsigned long addr, len, end; + unsigned long len, end; unsigned long flags; int nr = 0; start &= PAGE_MASK; - addr = start; len = (unsigned long) nr_pages << PAGE_SHIFT; end = start + len; @@ -1807,7 +1806,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, if (gup_fast_permitted(start, nr_pages, write)) { local_irq_save(flags); - gup_pgd_range(addr, end, write, pages, &nr); + gup_pgd_range(start, end, write, pages, &nr); local_irq_restore(flags); }