Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1080084imu; Tue, 11 Dec 2018 12:20:44 -0800 (PST) X-Google-Smtp-Source: AFSGD/VWDwjjK/aCN0SOZEHQCeypaOqzrKWIgB109HMVd94zRzI91FI8P19qu4gmiFanvqc/Aykw X-Received: by 2002:a63:5664:: with SMTP id g36mr15661386pgm.313.1544559644402; Tue, 11 Dec 2018 12:20:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544559644; cv=none; d=google.com; s=arc-20160816; b=CMljjB7aW13e/GduH+TJ5JDVLavsFf8QrpSBWeID3CviJfYmUfiNMRCaenJ7U92eFH 3RAtiefQyNsEkR4LuoDMk2/49tse0aX+DX9X7uRY0QZYlfAKcHVC1woMI3cJveXcq3Uf i3Duop9mY2mRajwzclkbV62o2tnt9wUftt+e14rB2GthhGYq4BxyuuDZBbyOlVEuZZMz Vqz2qhV6EPmiaELLNfrMLBhVGZQ9xIWKz9e/SgHipL7TSemyY6zBmXNyPNJAc6Rxlaxc e7i2MKPTcY1KPl0JRjWobV1mk2MiD7q4FgqyjDAU8O5avQo/s2r1r1vOkZe1Z/vXet/f qTHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=kCEgaBD//6bMnLItqfBWA5+JlwJ1nKRB8+EC9ddTVZ8=; b=t9KBgjPIYfbxAGw0afkALtvCdL1BPyE2dpVfoLwoFFBUllibztCJsFfbboNMtiibx7 5bKoaH7afTSEp3RdXudt1R9IRTSNk3PkzC6aTe2Kd1P2xf67ZO7ppU4rdTTwYX68+rr5 QL8KQf15w8SXjnyu5OiacRGo1VOHwsEj3CGru9BQUe8WHZU+3BjLI+jzu143kRcELH3x EKd9ho2Rs2fJVEIAz5evXSpX4/jQzpk254hwuzEp8/6tE9llGjaJqTn9ofBOnY00758E Imrzc2QKUKwhNGifYQ9UO8+Saafh6zavVuoQA9NUEvQxnO6rksvK2v/eOIXe6pI7C48p fr8Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d14si12410800pgi.158.2018.12.11.12.20.04; Tue, 11 Dec 2018 12:20:44 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726211AbeLKUTN (ORCPT + 99 others); Tue, 11 Dec 2018 15:19:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48078 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbeLKUTN (ORCPT ); Tue, 11 Dec 2018 15:19:13 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 071E788309; Tue, 11 Dec 2018 20:19:13 +0000 (UTC) Received: from redhat.com (ovpn-124-191.rdu2.redhat.com [10.10.124.191]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A2A2919C7D; Tue, 11 Dec 2018 20:19:11 +0000 (UTC) Date: Tue, 11 Dec 2018 15:19:09 -0500 From: Jerome Glisse To: Arnd Bergmann Cc: Andrew Morton , Stephen Rothwell , Michal Hocko , Mike Rapoport , David Rientjes , linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/mmu_notifier: fix mmu_notifier_range_init warning Message-ID: <20181211201909.GA6478@redhat.com> References: <20181211200526.3868586-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181211200526.3868586-1-arnd@arndb.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 11 Dec 2018 20:19:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 11, 2018 at 09:04:43PM +0100, Arnd Bergmann wrote: > The macro version of mmu_notifier_range_init() for CONFIG_MMU_NOTIFIER=n > does not evaluate all its arguments, leading to a warning in one case: > > mm/migrate.c: In function 'migrate_vma_pages': > mm/migrate.c:2711:20: error: unused variable 'mm' [-Werror=unused-variable] > struct mm_struct *mm = vma->vm_mm; > > Pass down the 'mm' as into the inline function as well so gcc can > see why the variable exists. > > Fixes: 137d92bd73b1 ("mm/mmu_notifier: use structure for invalidate_range_start/end calls v2") What about changing migrate.c (i actualy tried to do that everywhere in the patchset but i missed that spot) So we avoid one useless variable on such configuration: diff --git a/mm/migrate.c b/mm/migrate.c index f02bb4b22c1a..883fce631f47 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2701,7 +2701,6 @@ static void migrate_vma_pages(struct migrate_vma *migrate) const unsigned long npages = migrate->npages; const unsigned long start = migrate->start; struct vm_area_struct *vma = migrate->vma; - struct mm_struct *mm = vma->vm_mm; struct mmu_notifier_range range; unsigned long addr, i; bool notified = false; @@ -2724,8 +2723,8 @@ static void migrate_vma_pages(struct migrate_vma *migrate) if (!notified) { notified = true; - mmu_notifier_range_init(&range, mm, addr, - migrate->end, + mmu_notifier_range_init(&range, vma->vm_mm, + addr, migrate->end, MMU_NOTIFY_CLEAR); mmu_notifier_invalidate_range_start(&range); } > Signed-off-by: Arnd Bergmann > --- > include/linux/mmu_notifier.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h > index 29f7b9670ba3..b13ea00ded5d 100644 > --- a/include/linux/mmu_notifier.h > +++ b/include/linux/mmu_notifier.h > @@ -476,6 +476,7 @@ struct mmu_notifier_range { > }; > > static inline void _mmu_notifier_range_init(struct mmu_notifier_range *range, > + struct mm_struct *mm, > unsigned long start, > unsigned long end) > { > @@ -484,7 +485,7 @@ static inline void _mmu_notifier_range_init(struct mmu_notifier_range *range, > } > > #define mmu_notifier_range_init(range, mm, start, end, event) \ > - _mmu_notifier_range_init(range, start, end) > + _mmu_notifier_range_init(range, mm, start, end) > > > static inline int mm_has_notifiers(struct mm_struct *mm) > -- > 2.20.0 >