Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6170269ybv; Tue, 18 Feb 2020 11:16:43 -0800 (PST) X-Google-Smtp-Source: APXvYqxyu+5HXDhTHx24rvpi+AofU8EnVgEI4HTbOBQSGDTLY/ftllpW8HPAkMXKKbeI4SMg4O/2 X-Received: by 2002:a9d:7f8d:: with SMTP id t13mr15693337otp.175.1582053403372; Tue, 18 Feb 2020 11:16:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582053403; cv=none; d=google.com; s=arc-20160816; b=r7XHJmejqBQlf4Kk+8hnoG7smFdfWHtHX3Y2ctcqDb8ntUEXcs5x3W4q2rNzB1KDeX 2wIVxdt1XqbD8wAZYilx4eu1ZN/6EcruqwzbKymWxBL1DcnDludhibCGdOu9uv0adbBU a0u8GVS4yXZ1ZF9eLzfHxQXsbUgHRz86q/dyK8oCj7kBX7UST874NudXD8Kd2BrfNl2I x7rffD9C2nU+Jjra3iFaxScJIe4MpID4ptWPPAyQO3D4lANNBQ66pTK/YHKkcW29vtHz Zq+dpntJI0qzbIZ7Phphq783N5l9iIHlEWIelriuPvp+eN8zaovx4QNitk+IyrwGTPLI 7L3A== 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:date:cc:to:from:subject:message-id :dkim-signature; bh=X+HikanyDseXk6iSGhRmx2HuVl8693gA9nI6I0GJFyc=; b=AOKXaHFX9shCZUHz5zYdsU0jjlowOKsYvKP+DqsZVVFHHwkvHVjNT/s7KAE2q9qwg7 onT67c3JcwasDKcakbMH5SlC4PPXt+zLlA7fcb3ggZjuLEl6rPiDFm0uf9yiH60QtaoF udqEgNfhm37Rh2MXZz2GgYCLtG+QZoObaTvZ9P3YGz0M2bRFHK1UY1ZsKxzHTjHQ82VV PhKafqC55Zr/hh2/scpW3Z5baQ3u0CSzkJJfQPbp7ba5yvP2kD183QH4JuY3U1wa4hXg REeKT464nyKhsbcDi6xOELyp051wQkxoxMXEILis4tmRWMC/EvPhjStfv/Svwlk9Nu8k omtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=Rh73nB0G; 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 w20si8073827oic.103.2020.02.18.11.16.30; Tue, 18 Feb 2020 11:16:43 -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=@lca.pw header.s=google header.b=Rh73nB0G; 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 S1726383AbgBRTQO (ORCPT + 99 others); Tue, 18 Feb 2020 14:16:14 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:45151 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726283AbgBRTQO (ORCPT ); Tue, 18 Feb 2020 14:16:14 -0500 Received: by mail-qt1-f193.google.com with SMTP id d9so15320646qte.12 for ; Tue, 18 Feb 2020 11:16:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=X+HikanyDseXk6iSGhRmx2HuVl8693gA9nI6I0GJFyc=; b=Rh73nB0G8fWeZNlkBZdjrCndHlRKqMyPf1GnmJEFzyHhwg6ClOQUpxV0IKgK4q/mZM 19e3zijgpHqJvgb7fw+EZ+ODuLh75FC7sByLWxwfoJJAP8+RCACW9Mb67QViMspv5UcY q4d68KAXHLEAPiBB6bD9+LZ4gilK6hqew74YRA1sRhhqJj1eiH5zpCedCvGKricprPmA hq/ZuIupwO7HWjFDZlqyWBWX23zXORg3qgdJZ4ru6A+ELULAc/fbyzNFkzv3QrTXE/mV niFwlXhnQ6lG65+gMvNGRRtckdPZCqFLEJ5lYfj08kWh5aUKCqe/61WPrz0qC4B1dKrt xf6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=X+HikanyDseXk6iSGhRmx2HuVl8693gA9nI6I0GJFyc=; b=jcZZdHtz3fw6mr2LdC2lydnzZwOYI86hfGzHDjoXgD/COsGz5GfCXH8v9C4Mu3nyHS c6L+qMIL0seyBBdoBNVHBeAQPHUNoBPqkXIk6MOw5sk/5aq4i+QSnFU+ODLftF1tHrfw B7nnI/Nm66qF+Ynkwv0n+7KRDXm6v8r3KxgrurK4w93nI8o4MqrxeTWmY3ti6IQ4zCOk 6YJyR8S2+oRLPeo+aI1iVxyk0RcTeG34gG+kSad6aSTgPYeo+cDVmTkxTZGUhiRxul6H nxdlVvKSm8BD8C2wh4ToSSEqBFW3Ccm02J2nZxFzv7CRFDO5XZknr/XRtimMB98o6Hey Qb/A== X-Gm-Message-State: APjAAAVbICt8flYPywxCljZDtOGcQM4zO/mhF+FFY9PV53JH18x5d7ei nDaY847jo7QCXmZKXG1xb0hc9g== X-Received: by 2002:ac8:6607:: with SMTP id c7mr18616033qtp.51.1582053372940; Tue, 18 Feb 2020 11:16:12 -0800 (PST) Received: from dhcp-41-57.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id a192sm2406482qkb.53.2020.02.18.11.16.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Feb 2020 11:16:12 -0800 (PST) Message-ID: <1582053371.7365.98.camel@lca.pw> Subject: Re: [PATCH -next] mm/hugetlb_cgroup: fix a -Wunused-but-set-variable From: Qian Cai To: Mina Almasry Cc: Andrew Morton , linux-mm@kvack.org, open list Date: Tue, 18 Feb 2020 14:16:11 -0500 In-Reply-To: References: <1581953454-10671-1-git-send-email-cai@lca.pw> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 (3.22.6-10.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2020-02-18 at 10:58 -0800, Mina Almasry wrote: > On Mon, Feb 17, 2020 at 7:31 AM Qian Cai wrote: > > > > The commit c32300516047 ("hugetlb_cgroup: add interface for > > charge/uncharge hugetlb reservations") forgot to remove an unused > > variable, > > > > mm/hugetlb_cgroup.c: In function 'hugetlb_cgroup_migrate': > > mm/hugetlb_cgroup.c:777:25: warning: variable 'h_cg' set but not used > > [-Wunused-but-set-variable] > > struct hugetlb_cgroup *h_cg; > > ^~~~ > > > > Signed-off-by: Qian Cai > > --- > > mm/hugetlb_cgroup.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c > > index ad777fecad28..8a86a2b62bef 100644 > > --- a/mm/hugetlb_cgroup.c > > +++ b/mm/hugetlb_cgroup.c > > @@ -774,7 +774,6 @@ void __init hugetlb_cgroup_file_init(void) > > */ > > void hugetlb_cgroup_migrate(struct page *oldhpage, struct page *newhpage) > > { > > - struct hugetlb_cgroup *h_cg; > > struct hugetlb_cgroup *h_cg_rsvd; > > struct hstate *h = page_hstate(oldhpage); > > > > @@ -783,7 +782,6 @@ void hugetlb_cgroup_migrate(struct page *oldhpage, struct page *newhpage) > > > > VM_BUG_ON_PAGE(!PageHuge(oldhpage), oldhpage); > > spin_lock(&hugetlb_lock); > > - h_cg = hugetlb_cgroup_from_page(oldhpage); > > h_cg_rsvd = hugetlb_cgroup_from_page_rsvd(oldhpage); > > set_hugetlb_cgroup(oldhpage, NULL); > > > > -- > > 1.8.3.1 > > > > Hi Qian, > > Thank you very much for the fix to remove the warning, but actually > the real fix is I'm missing a 'set_hugetlb_cgroup(newhpage, h_cg);' > which will use the variable and set the cgroup on newhpage which is > needed. I'll submit the proper fix. > > What bothers me though is that locally when I checkout the broken > patch and try to build I don't see the warning: > > make -j80 mm/hugetlb_cgroup.o > no warning. > make -j80 mm/hugetlb_cgroup.o CFLAGS_KERNEL="-Wall" > no warning > make -j80 mm/hugetlb_cgroup.o CFLAGS_KERNEL="-Wunused-but-set-variable" > I see the warning. > > So it seems there is a bunch of warnings I need to explicitly turn on > otherwise I will continually submit patches that introduce warnings in > your build. Any idea why I'm running into this? Do you also have to > turn on these warnings manually on your make line? Is it related to > gcc version? My gcc version is: > gcc version 9.2.1 20190909 (Debian 9.2.1-8) I am doing "make W=1" which will turn on those warnings. Quite noisy but you can "grep" what you are interested in.