From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12474C47089 for ; Wed, 26 May 2021 22:29:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B14D2613CA for ; Wed, 26 May 2021 22:29:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B14D2613CA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 481126B006E; Wed, 26 May 2021 18:29:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 458A36B0070; Wed, 26 May 2021 18:29:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 020DA6B0071; Wed, 26 May 2021 18:29:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0039.hostedemail.com [216.40.44.39]) by kanga.kvack.org (Postfix) with ESMTP id B210C6B006E for ; Wed, 26 May 2021 18:29:09 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4314B181AEF3E for ; Wed, 26 May 2021 22:29:09 +0000 (UTC) X-FDA: 78184824018.29.AE29CE7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 0CAD72CA for ; Wed, 26 May 2021 22:29:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622068148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KJRZ7Xr9eE1StDnH/ATVl1uLoI8ZB4qRKeY2WD/qOD0=; b=RdAqaaVbjxumXqNozNHd/VvDu8nyFBuKEAimvp7PD9pEhR4V9FImzFizfkrZqvkM8vumX7 oq0oogZdUUGDDqDHiv9y1QErZaMaI7WOcaO+eM9bXh5QK0CwWiicf9FIieqnq1q+8B013N xw7Y5XkyoX0tHHev28wyIdm0z6FnDRY= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-211-EOezxRPoP--SW5b0EP8UZw-1; Wed, 26 May 2021 18:29:04 -0400 X-MC-Unique: EOezxRPoP--SW5b0EP8UZw-1 Received: by mail-qk1-f200.google.com with SMTP id l6-20020a3770060000b02902fa5329f2b4so1937702qkc.18 for ; Wed, 26 May 2021 15:29:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=KJRZ7Xr9eE1StDnH/ATVl1uLoI8ZB4qRKeY2WD/qOD0=; b=cm5pPpsIMHW0CdXOZtb4Z/OTyFa+z7XlbmG17SHdn5oU32eALJBdP8l/K8p8hyfqLb bBsAz7TE0O65EjBtgNXidl3QNFx8xU0Jwh76z2xGEBZJeJhAVtXkCxGgxf9YkIlSoDd4 1rrAEisAGh3vTx5yPLyymALpsOhbQHsIM1cgD5hcFxmkKfFenTaoUKKmtyBV8ELIO//e JXCB19/fPetf765gm07dTrsXm0u2fAhzIDa6Y1Z4eWs/L/Z/mISJ3EVEyeZmBXeSS/Va Su6SlHPJ66iK2UDKle+GaTw2QCxzgeD90sPLy+bJgGgYJfeg0cFnJ/mGrCA1TccD7Voc bRMQ== X-Gm-Message-State: AOAM530DVPJ4v1cn71mWj97P7aRxprfcbclZelKFbJAqufUOlAhzUcLo QdgI17Bgyzg8UbSvCuCjSl09w5zvNK+9CXQCpJoJj4HXtsok5eYwrixp/6w78l28Mp04pAUPYF8 4HrEOEuBnd7w= X-Received: by 2002:a37:e11:: with SMTP id 17mr364053qko.499.1622068144279; Wed, 26 May 2021 15:29:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzYClyKpygSkxiLgjGmd4Z0WDwgsAIxTAfrAxM/4Ef8VZM6cO98o6XMM6GieLiHaSuGLwpCg== X-Received: by 2002:a37:e11:: with SMTP id 17mr364043qko.499.1622068144117; Wed, 26 May 2021 15:29:04 -0700 (PDT) Received: from llong.remote.csb ([2601:191:8500:76c0::cdbc]) by smtp.gmail.com with ESMTPSA id v17sm203783qta.77.2021.05.26.15.29.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 May 2021 15:29:03 -0700 (PDT) From: Waiman Long X-Google-Original-From: Waiman Long Subject: Re: [PATCH-next] mm/memcontrol.c: Fix potential uninitialized variable warning To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Vladimir Davydov , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Muchun Song References: <20210526193602.8742-1-longman@redhat.com> <20210526134321.42bbd4a9dcbcf53e855c5b1b@linux-foundation.org> Message-ID: <9fb60ba4-258d-2bb5-57af-c174df9b1a31@redhat.com> Date: Wed, 26 May 2021 18:29:02 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <20210526134321.42bbd4a9dcbcf53e855c5b1b@linux-foundation.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RdAqaaVb; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf04.hostedemail.com: domain of llong@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=llong@redhat.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 0CAD72CA X-Stat-Signature: msxnbb8caaa7jpkmp3utr1upe57m8oze X-HE-Tag: 1622068144-529163 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 5/26/21 4:43 PM, Andrew Morton wrote: > On Wed, 26 May 2021 15:36:02 -0400 Waiman Long wro= te: > >> If the -Wno-maybe-uninitialized gcc option is not specified, compilati= on >> of memcontrol.c may generate the following warnings: >> >> mm/memcontrol.c: In function =E2=80=98refill_obj_stock=E2=80=99: >> ./arch/x86/include/asm/irqflags.h:127:17: warning: =E2=80=98flags=E2=80= =99 may be used uninitialized in this function [-Wmaybe-uninitialized] >> return !(flags & X86_EFLAGS_IF); >> ~~~~~~~^~~~~~~~~~~~~~~~ >> mm/memcontrol.c:3216:16: note: =E2=80=98flags=E2=80=99 was declared he= re >> unsigned long flags; >> ^~~~~ >> In file included from mm/memcontrol.c:29: >> mm/memcontrol.c: In function =E2=80=98uncharge_page=E2=80=99: >> ./include/linux/memcontrol.h:797:2: warning: =E2=80=98objcg=E2=80=99 m= ay be used uninitialized in this function [-Wmaybe-uninitialized] >> percpu_ref_put(&objcg->refcnt); >> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> Fix that by properly initializing *pflags in get_obj_stock() and >> introducing a use_objcg bool variable in uncharge_page() to avoid >> potentially accessing the struct page data twice. >> > Thanks. I'll queue this as a fix against your "mm/memcg: optimize user > context object stock access". > Thanks for that. Cheers, Longman