Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1130061imu; Tue, 11 Dec 2018 13:15:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/VWK/wqVlbVjB3AC4U5TQV5W+A5R4G+ANIeaSNwMH1Sx2v4gVx9+DjoSkGuiRAdzBksssm1 X-Received: by 2002:a63:26c1:: with SMTP id m184mr15022245pgm.367.1544562931298; Tue, 11 Dec 2018 13:15:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544562931; cv=none; d=google.com; s=arc-20160816; b=rWd4zNGTQHD7mNQ7RxIH2PjIZ0jXZ2MYt3nQJiRixnZz1K5M9d9wOXg/LAR+73PZsm XL8UPqAs1lDlkouD6UoSknz4veT35YmQRuOKWjVSQ+YbjLJnQHSPTvTqhjz0MDmLrK67 a95dJqMpFk7kCqOOY5mSMCpY6At9Y5JkstFTjaaMedp+mEBRwb4frTLl5iNcsGpuzxtg bpzNv0v9JU8nBQs/oZuAc5JtyaIgyvdhafHaMXoHcdDbGNx92O+lZJnXaJholwYTpzTH D9nARGwBHPcAXlv9FwPPlBDsbkHkpFodDMBl00HKNpjSiDddoasJBNBfnj7fD2Kh01mA 0eFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=lPrFjhTsNHUUayrOVZ+SpfzOV4fwLjJ9piWRaxrSzko=; b=B+FPskdVlzpl2xvC4jzyC+Js0tZLE08nN/zmocsCO+ixuNEnkl/+gIpg29XIPeRF8u en5fqWQ3RLAVvUnvKtfWr7aK0TUwnDkD2Z2u57OxcVrEiYnNYbIWm1qprPMyV2H+4tI3 eluzzg6S3VwKKIcJTQXgnecRM8Kes551yJD6NpGq/0sVZQMa8dN2UpcLus/vR3j1uLsB CDZBw5KjPLQYnCckZpk0iWWmNAp4zVOynaXzSzKfAPrLxsED/trilDiRUh7OcbQ8JYt9 ge/+/H/OYkWuFf6J0dc7E2465GMDWhpA4W/5mr8Pk3aNc0xn+5nYoIhTJPRVbQxvN9HS MZow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TvvrhnAU; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g83si13746498pfb.278.2018.12.11.13.15.16; Tue, 11 Dec 2018 13:15:31 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=TvvrhnAU; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726252AbeLKVM5 (ORCPT + 99 others); Tue, 11 Dec 2018 16:12:57 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:42787 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726134AbeLKVM4 (ORCPT ); Tue, 11 Dec 2018 16:12:56 -0500 Received: by mail-pl1-f195.google.com with SMTP id y1so7494530plp.9 for ; Tue, 11 Dec 2018 13:12:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=lPrFjhTsNHUUayrOVZ+SpfzOV4fwLjJ9piWRaxrSzko=; b=TvvrhnAUzDAlfjotKGhxfewuauVpZld1xXZ05uqRFJ+QMOGmLdUv6WeF2zyAq5AaPL ZNlsc+HPoOOGAbghz93ggz7EoS9WntxLPXsUw1t/Les2dYBlfXaqoVBmzeDtQKfdeXC2 aEvdpjExbiN1zlAreBZBoDImLY4awKlNw9ZZ6zwvQQSRST0kAYw6bcBxDN2Or/mvFZYF be4MIULUFl8LeZ35OL7aOHTsZPOgmOMhGdTUT2/skioMBhOQNmhFylxWz4aPJ8XkKzBi 6l5Z7k3RYLR/echceWFpDe45ygsiiJ2t2r3x5Tqi1Fhgk6UhiJIJVj0H8B5cU2Ys2P49 B/Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=lPrFjhTsNHUUayrOVZ+SpfzOV4fwLjJ9piWRaxrSzko=; b=KVqVXH5TsFvvGOFGWhz9UXqgYDyyUTfWm7AV1yKv4iMXXbAdsLeoPmCXbdMjWSgcbz V6GjWtPtF0DWwstHpT8V73zRC9UlhU+NICsr9r8+uR+udtDR7o0Gb14F9/ueKINXmaVm Cd8Gt3GqddbnE179Wh7SVW5R8hotU9q1j8iQkWGHWmZySvAMPiaTyzoYvbKbZtqf9uHm qeYrKmk8NajTJfCaPoPTluyvZLkycSZtcTCksUdd7oyZkKqfGIA4b1iqYcMXT9YaLL8y ePnQtCclyO6IMqUbu8eZjy6euMO0jGkAnpXEE98FPikB2akNMrKduU/pOAiTTDv7+0bO utHg== X-Gm-Message-State: AA+aEWYXE4dvODoY89VnSzGGuRkmCTwjajegwJOLzPAJ2Bv7+M4DGu3N Kwl9WGScR5E/3EaokxIWU5PcnQ== X-Received: by 2002:a17:902:8f97:: with SMTP id z23mr17748953plo.283.1544562775705; Tue, 11 Dec 2018 13:12:55 -0800 (PST) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id e86sm23104576pfb.6.2018.12.11.13.12.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Dec 2018 13:12:54 -0800 (PST) Date: Tue, 11 Dec 2018 13:12:54 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Jerome Glisse 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 In-Reply-To: <20181211201909.GA6478@redhat.com> Message-ID: References: <20181211200526.3868586-1-arnd@arndb.de> <20181211201909.GA6478@redhat.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?