Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2452573imc; Tue, 12 Mar 2019 14:19:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyX4geV9jZ4RiY9XD6qgi3d6nIHOM5msGfHmbAEIq168cwIGKQpXPyx2Ed1z44ZSxEuVWsR X-Received: by 2002:aa7:9143:: with SMTP id 3mr40679762pfi.238.1552425579148; Tue, 12 Mar 2019 14:19:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552425579; cv=none; d=google.com; s=arc-20160816; b=O5cFem5Ym88F2cCUVsycCEYTB0vw6hcGxKtihHYB6jhZFmK6uN35f4ZBtdIEkhmNdV Qtds/NIPIYx4YKTp6p7cXsvHIheUCjAbkFup6ZEdPmkYdKsIrTolXQQRdisMb2E1ElUU 5VSTH0JcDr8ftY0Lv7fKcGP6acSSUbX1uYMj4f+uPZ3sWmINxxNWAvvXynsPRsm0J5nV gheQUAFRXJaH5L0K8VSg+wTpP2zqdxLj566uKCQ9ZwvCgmhsQq5pyHNT4ZFNSDDOw6ah nIgGzcMTA0yEpJv30CmKiLLpUMVcSNHEQSxawhTCONkMJhOIIQFmyf/Z+kDyPjN4h7fm AJgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=gfoR90FAE2ZTfWcvfu5Iel8TnOC4RF7tWdZ/YYSxCO0=; b=Nilsf+WSwIJQuoRgX+nEoqqr02veE0eCFG9o70zfzKDOtPIRKOZVJQcK8le/sIB0sK mgGkH09TnvVrBKUEO2HAW7qZCuMAzKjhxS7dM6Wcj77RRjYk+qz+ng+EZFqLb1YA/Xsl M0Jj0r7ZH0Vs6MoEUmrbwAjzyaYM8JjLBRNeBhYCkquug2SsSRouft08FJqxnuQk8tnD qiCsupZRn/my0ZEkmhagI9cF+/DsgotDcR8X917GR1vWENCGWHJs01JP9U6OroTSu1gN ip7sk8NX0QuhQAZVQnFv2XAjQI7I63i4NU6MYCU+D1zuJoCYr6W07JMonUOQ5cxBmRmS i6Kg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1si8286814pgq.72.2019.03.12.14.19.22; Tue, 12 Mar 2019 14:19:39 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726646AbfCLVS4 (ORCPT + 99 others); Tue, 12 Mar 2019 17:18:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60034 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726329AbfCLVS4 (ORCPT ); Tue, 12 Mar 2019 17:18:56 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 47AACE3F; Tue, 12 Mar 2019 21:18:55 +0000 (UTC) Date: Tue, 12 Mar 2019 14:18:54 -0700 From: Andrew Morton To: Bartosz Golaszewski Cc: Khalid Aziz , Bartosz Golaszewski , Anthony Yznaga , "Aneesh Kumar K . V" , =?UTF-8?B?SsOpcsO0bWU=?= Glisse , linux-mm@kvack.org, LKML Subject: Re: [PATCH] mm: remove unused variable Message-Id: <20190312141854.7a06e640a611344243a25461@linux-foundation.org> In-Reply-To: References: <20190312132852.20115-1-brgl@bgdev.pl> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Mar 2019 15:03:52 +0100 Bartosz Golaszewski wrote: > wt., 12 mar 2019 o 14:59 Khalid Aziz napisaƂ(a): > > > > On 3/12/19 7:28 AM, Bartosz Golaszewski wrote: > > > From: Bartosz Golaszewski > > > > > > The mm variable is set but unused. Remove it. > > > > It is used. Look further down for calls to set_pte_at(). > > > > -- > > Khalid > > > > > > > > Signed-off-by: Bartosz Golaszewski > > > --- > > > mm/mprotect.c | 1 - > > > 1 file changed, 1 deletion(-) > > > > > > diff --git a/mm/mprotect.c b/mm/mprotect.c > > > index 028c724dcb1a..130dac3ad04f 100644 > > > --- a/mm/mprotect.c > > > +++ b/mm/mprotect.c > > > @@ -39,7 +39,6 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, > > > unsigned long addr, unsigned long end, pgprot_t newprot, > > > int dirty_accountable, int prot_numa) > > > { > > > - struct mm_struct *mm = vma->vm_mm; > > > pte_t *pte, oldpte; > > > spinlock_t *ptl; > > > unsigned long pages = 0; > > > > > > > > > Oops, I blindly assumed the compiler is right, sorry for that. GCC > complains it's unused when building usermode linux. I guess it's a > matter of how set_pte_at() is defined for ARCH=um. I'll take a second > look. > The problem is that set_pte_at() is implemented as a macro on some architectures. The appropriate fix is to make all architectures use a static inline C functions in all cases. That will make the compiler think that the `mm' arg is used, even if it is not.