Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp95137pxj; Wed, 26 May 2021 17:14:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXsjXCexACdsTJi1IWrNpSHE+Fe6YLcCYsONBVRQDPuxkcxjNQ5/uxQqhr4hmamo0jlPK9 X-Received: by 2002:a17:906:5fc1:: with SMTP id k1mr913750ejv.300.1622074479236; Wed, 26 May 2021 17:14:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622074479; cv=none; d=google.com; s=arc-20160816; b=ROkmDirhJrJ8pK0XSrclBrc67lh3rEjg/H81jzffjWEg3n+sq0HD7e0gJFXarqDPzF uAG2bFPRGTprFtZpePDRhe65yluR7zr5Hs0x0hNG7Ua0+eEgFXF0jtfGY3tqCmQf3xNW uE7SajAI+bkWJEb4E1DS7IT+sApv4CbW7CuCxGQDMO4lhvcWCO9E5EY7T0J/jNMJXnh1 UEpavuNhhkL/iwHNVzL1ZV1zcW4JXVoDBRF6BzzV5yg2q+o+eWLADoGX0M7FZ1Gac5JK ORD0N08A/nKjpgszmGfYjobR0CDF2LppbrK09QMQi5JiPaL+vvEbI73Watx6kbenOtEK QBIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=YK0HK8SddRVxrwuBwsBghwjMXyZAABZvTc/7taEf54w=; b=zPpNbYrARGwVIP8M5w89RwECSDGoIkfEgVYaGMhjBKyLD4tik4xVKdIPvcqUi0QcU8 UCOpB+ro5QPFO9aSImhrtIuTMNtU1ogISXuuXFPYa8HeE6ew8nWitDVgiAZ/iJyk50Dx iO3mjV66EDr+wUWmgNspl6lBHYYoc847l5fmnoju4+Ag/koWCvPT6mHnyqBdf6jxnJHz yh102nIuhZVw3yMvTT6jCOoLhBMsNKaVwlRRYxScPteaKNwkZC4D6Olr2gyxPu6+oNj5 MdEAt6qozQkMpR/BJRS0MH1WmZw+PlVLayLi9S5NO0at/9akAGf+W7n++F0ka/mLPAvX 6d9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=RyuWUuz9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 8si657251ejx.637.2021.05.26.17.14.16; Wed, 26 May 2021 17:14:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=RyuWUuz9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232236AbhEZUpI (ORCPT + 99 others); Wed, 26 May 2021 16:45:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:53544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231321AbhEZUpG (ORCPT ); Wed, 26 May 2021 16:45:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DD4EA613C7; Wed, 26 May 2021 20:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1622061802; bh=Wc0VpiNTofyWs1k/w7vX8Lh3TnH80xRCPirGtLFyVPI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RyuWUuz9Wqha7WDVAel0HwsYR+YjnUkiTHQ+CA3lL0pH90SXDsGQYssU3bqAAmuPf GC199lyAGoWTlfwC4P3vddNREIR+y8QrjvVuIjzWkrxwW7YbtgkT8bxAPjON4pwXWI TB1H3Y0KdYu/CHYNaF+lt3nafVuovwyPpQLIotV0= Date: Wed, 26 May 2021 13:43:21 -0700 From: Andrew Morton To: Waiman Long Cc: Johannes Weiner , Michal Hocko , Vladimir Davydov , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Muchun Song Subject: Re: [PATCH-next] mm/memcontrol.c: Fix potential uninitialized variable warning Message-Id: <20210526134321.42bbd4a9dcbcf53e855c5b1b@linux-foundation.org> In-Reply-To: <20210526193602.8742-1-longman@redhat.com> References: <20210526193602.8742-1-longman@redhat.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 26 May 2021 15:36:02 -0400 Waiman Long wrote: > If the -Wno-maybe-uninitialized gcc option is not specified, compilation > of memcontrol.c may generate the following warnings: > > mm/memcontrol.c: In function ‘refill_obj_stock’: > ./arch/x86/include/asm/irqflags.h:127:17: warning: ‘flags’ may be used uninitialized in this function [-Wmaybe-uninitialized] > return !(flags & X86_EFLAGS_IF); > ~~~~~~~^~~~~~~~~~~~~~~~ > mm/memcontrol.c:3216:16: note: ‘flags’ was declared here > unsigned long flags; > ^~~~~ > In file included from mm/memcontrol.c:29: > mm/memcontrol.c: In function ‘uncharge_page’: > ./include/linux/memcontrol.h:797:2: warning: ‘objcg’ may 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".