Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6154432ybv; Tue, 18 Feb 2020 11:00:32 -0800 (PST) X-Google-Smtp-Source: APXvYqxjOpAMdQIqT3UvJCrB0Mx834xacdA1pJc2uJGA6OZEjkSlvXeArjmMQQz04OmKS+m4Nl2o X-Received: by 2002:a9d:6a2:: with SMTP id 31mr16492156otx.313.1582052432408; Tue, 18 Feb 2020 11:00:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582052432; cv=none; d=google.com; s=arc-20160816; b=AprnlZqKkIoXWD5iVsA2yh+OUPYo5MLp+Mb9Hrv/j4unPdbiZnTkTnFTExzf5py4wx ntQst93KxyB6gtrsKd9jc7d1WqLYhfqqlcBuS4zLNFlQ75zNQnNFzfe2IRDJL78poCs+ Y8VNwRzegDNMdPxXsknUc6bjlYfeOqh7EulI9OazNfNLdaApvuATK7Ink2Zed2Yuy7z+ YbI39l1RUr95N9RWrbxIsdYlMiKdb9BM9V7tCSo277SlDH7rRjINsYk1WC5ixVcyvGEV biprtLQQqSZsA+Tbxyy8fILHVkbvUFMZQxrwxbKqxasAz9j9hAn6qMb5KKPBld3enEqr ta+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=WZFvoNuat14DefXi3vC+e4qmKLvk+S8JScj25aPSjJM=; b=Wa+/QDewbaDZLtSv7YlRigwlq1M+YbgocMoFKGvu6yFd6ncWjjFIqfvWQS/Vnex+H6 fIpeH4I8taSSscXdCQ0MubcyH924oZi8E5pAE0FvCGXyJpi/NrG92RDlZZoDopv4CdoF g5ERVnEs//dr0ceiP5qGYQp4IPhcce4p5v9MeePQqIZmvRze6EyCMOvrxLH18SE2A4m3 KywS5RgZoZrXU0G48xysyIGnraSWKHiydpaH7uanNxtB8VDYIAL0nWgVbu+6/iWJCr9n A//AbODbhgqK2mKk/T/X1dGt8sLrqQog4akTOaYzt62kNAMF3klui1/agIIwfUfBiFgm fQYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RXtXrgDu; 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 x26si2104553otk.325.2020.02.18.11.00.19; Tue, 18 Feb 2020 11:00:32 -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=RXtXrgDu; 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 S1726512AbgBRS7H (ORCPT + 99 others); Tue, 18 Feb 2020 13:59:07 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:41551 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726283AbgBRS7G (ORCPT ); Tue, 18 Feb 2020 13:59:06 -0500 Received: by mail-oi1-f196.google.com with SMTP id i1so21166019oie.8 for ; Tue, 18 Feb 2020 10:59:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WZFvoNuat14DefXi3vC+e4qmKLvk+S8JScj25aPSjJM=; b=RXtXrgDuvdnL5sCqfStcIcksH2FbUwtj3cgM6nLEKhgSNXkXrcUMffZk6UldfpqpMG X6dh/gjt88bBu4+jBnuobt1v8D2N4tLZeLUjKr4WEUTxePmfxQ3neGT+mn0nUdnLNK5o 9Jut24B90o864Pp7Xjs5gL/IozPfu/Rp0O+FFh8ztNqkQO/ZNx2SqLTFu6YNgO7r6GVs FBhMpai3M7D+zRzuhqGr9Ty2NLoujyfdLdmTXnwyjtBrOh5tTLyRhNrq15Sj1JFoJNiZ 6RBAYTOui7DFY2bim6bgI7GQQIudoc7j2qirGJO2qcAWK/BIVqKIeYLgX1r/1bW0yv05 B7Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WZFvoNuat14DefXi3vC+e4qmKLvk+S8JScj25aPSjJM=; b=pHihBuTHfBwq5IQ/L0D+D+WDP2K+BMEZSq+fsxIqKKyEVqYaIJQ7SspU6EpjuUGQWR 9suG/fgbHH60yAeiJbhbdFp4T55pb5lzroRhl5kGTLdNcISna2UjlKnoDTFc5nr1v9tY DeJDJWDvE9FCV8zowaaoxcKXIhCbjy0fixDesjUlw5qVo/+5CyVdnSL6hCk+hFsIq3Rk h9BMn70D0jM5ApqnWl+dms+Gpo4zHSxiW0RO08zSCjwooChl2OvWtAAVkwiGXUn9D/F7 i7PQbYj4bK4Ew+vQubKWk8PkL2tEQwY97ONwrVKhvmvkIgME2oUKe7JYmYq9sBO+/d5k hM4Q== X-Gm-Message-State: APjAAAVzg97BNZvVCcYXpLtltTyh3A2C8NQfyULn9zVmAXtUQ9AyA1fn PZzo/S8azArgeBlSSTnnCLC3V9HQp4+uJsU1/IhiOQ== X-Received: by 2002:aca:d6c8:: with SMTP id n191mr2306419oig.103.1582052345973; Tue, 18 Feb 2020 10:59:05 -0800 (PST) MIME-Version: 1.0 References: <1581953454-10671-1-git-send-email-cai@lca.pw> In-Reply-To: <1581953454-10671-1-git-send-email-cai@lca.pw> From: Mina Almasry Date: Tue, 18 Feb 2020 10:58:54 -0800 Message-ID: Subject: Re: [PATCH -next] mm/hugetlb_cgroup: fix a -Wunused-but-set-variable To: Qian Cai Cc: Andrew Morton , linux-mm@kvack.org, open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)