Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1149862imu; Tue, 11 Dec 2018 13:37:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/X5stkue+FUz9GKnCP4Kkip8LZF4248nKNTrKB0m+vOQllp8tOVLfPhBWToJlhSn1UU2iMQ X-Received: by 2002:a17:902:2dc3:: with SMTP id p61mr17162558plb.166.1544564269186; Tue, 11 Dec 2018 13:37:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544564269; cv=none; d=google.com; s=arc-20160816; b=wJI3cGMP9SvAQWuCu0VWoPZ1Ah05M+DIBtcNrAp9KZp4VD2ros0Uk3nSj+MFe9XBCZ klQe/AORT2eLqe9xFg02RZtwgFbM9zpocF7VLDDjwSv5foogiUkMfqv7GSVTU1b3LKiH G1RLJukM5Ft/lOKR5eks1AKdI8s69GLXA77xb1jkKUel8JWwMYS9b+uWFk7nj4Bjmjij XAKEe1AfquGsAthjuInQhj4Koq3oEQr2l8uSplLPatVsMg2FTD2Po7g1zh+rHsrYKlcC CuwhcI9VTPRXhCIRZ326SULXSj5x+U9dljsE+irUmrh3lj/vabLNnyLw/277vSoxBAru yxhA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Dtufrb3MrltoVBEpMtjGvYuBNhzJDCrV1pc74XM37wk=; b=fzPKzAmaU9Mr0hyd4ZxgrjoWiQy2B6ZJl83n1HwsnfmXq4emPuw8yeTcZ8wf2lyRU6 iYCc8X9ugcVFeRZVZdMtrH56dkUyNbmRFwqmILe3zz7SUXRMlhXAOZAkjJ1txIQs+hZO 7BSoWOi2ZFOkb3j7UAImseVmqDbA49Nrcx7k6UqxKyTB7/ah5n7Uy1WQ++nvzZ2V11MQ 9Boyq1A6IyeqpJiNmhtt8PU36L4EMy+M1Ls2t42+vXQfr2bqQ6noEa1QoUPP1ogSxHY3 NpZoR2st9S7YzR4Zdrks0ITYnL4QDGxSPxUV6gjmgEok6C88qkPXDVDPNj9rwzH6jZZi oXnQ== 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 t1si12633163pgj.542.2018.12.11.13.37.33; Tue, 11 Dec 2018 13:37:49 -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 S1726230AbeLKVgk (ORCPT + 99 others); Tue, 11 Dec 2018 16:36:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56529 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726134AbeLKVgk (ORCPT ); Tue, 11 Dec 2018 16:36:40 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E9EC6811D3; Tue, 11 Dec 2018 21:36:39 +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 B63915D70A; Tue, 11 Dec 2018 21:36:38 +0000 (UTC) Date: Tue, 11 Dec 2018 16:36:36 -0500 From: Jerome Glisse To: David Rientjes Cc: Arnd Bergmann , Andrew Morton , Stephen Rothwell , Michal Hocko , Mike Rapoport , linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/mmu_notifier: fix mmu_notifier_range_init warning Message-ID: <20181211213636.GB6478@redhat.com> References: <20181211200526.3868586-1-arnd@arndb.de> <20181211201909.GA6478@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 11 Dec 2018 21:36:40 +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 01:12:54PM -0800, David Rientjes wrote: > On Tue, 11 Dec 2018, Jerome Glisse wrote: > > > 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); > > } > > Wouldn't it be better to just declare mmu_notifier_range_init() as a > static inline function rather than a #define to avoid this warning? The define trick is use to drop the event parameter so that we do not need to define the event value for CONFIG_MMU_NOTIFIER=n case. Cheers, J?r?me