From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757187AbdLPWZl (ORCPT ); Sat, 16 Dec 2017 17:25:41 -0500 Received: from out0-241.mail.aliyun.com ([140.205.0.241]:50942 "EHLO out0-241.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756904AbdLPWZh (ORCPT ); Sat, 16 Dec 2017 17:25:37 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R611e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e02c03278;MF=yang.s@alibaba-inc.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---.9kEEv-D_1513463122; Subject: Re: [PATCH] mm: thp: avoid uninitialized variable use To: Arnd Bergmann Cc: Andrew Morton , Michal Hocko , "Kirill A. Shutemov" , Stephen Rothwell , Vlastimil Babka , David Rientjes , Ingo Molnar , Linux-MM , Linux Kernel Mailing List References: <20171215125129.2948634-1-arnd@arndb.de> <8d5476e2-5f87-1134-62d4-9f649c4e709a@alibaba-inc.com> From: "Yang Shi" Message-ID: <63b69d2b-1c1d-6f08-30a6-e996b6842000@alibaba-inc.com> Date: Sun, 17 Dec 2017 06:25:17 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/16/17 4:24 AM, Arnd Bergmann wrote: > On Fri, Dec 15, 2017 at 7:01 PM, Yang Shi wrote: >> >> >> On 12/15/17 4:51 AM, Arnd Bergmann wrote: >>> >>> When the down_read_trylock() fails, 'vma' has not been initialized >>> yet, which gcc now warns about: >>> >>> mm/khugepaged.c: In function 'khugepaged': >>> mm/khugepaged.c:1659:25: error: 'vma' may be used uninitialized in this >>> function [-Werror=maybe-uninitialized] >> >> >> Arnd, >> >> Thanks for catching this. I'm wondering why my test didn't catch it. It >> might be because my gcc is old. I'm using gcc 4.8.5 on centos 7. > > Correct, gcc-4.8 and earlier have too many false-positive warnings with > -Wmaybe-uninitialized, so we turn it off on those versions. 4.9 is much > better here, but I'd recommend using gcc-6 or gcc-7 when you upgrade, > they have a much better set of default warnings besides producing better > binary code. Thanks, I just upgraded gcc to 6.4 on my cetnos 7 machine. But, I ran into a build error with 4.15-rc3 kernel, but 4.14 is fine. I bisected to a commit in Makefile. I will email my bug report to the mailing list. Regards, Yang > > See http://git.infradead.org/users/segher/buildall.git for a simple way > to build toolchains suitable for building kernels in varying architectures > and versions. > > Arnd > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id 07CF844040A for ; Sat, 16 Dec 2017 17:25:31 -0500 (EST) Received: by mail-pf0-f199.google.com with SMTP id u3so10350196pfl.5 for ; Sat, 16 Dec 2017 14:25:30 -0800 (PST) Received: from out0-201.mail.aliyun.com (out0-201.mail.aliyun.com. [140.205.0.201]) by mx.google.com with ESMTPS id v1si7180417pfi.8.2017.12.16.14.25.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Dec 2017 14:25:30 -0800 (PST) Subject: Re: [PATCH] mm: thp: avoid uninitialized variable use References: <20171215125129.2948634-1-arnd@arndb.de> <8d5476e2-5f87-1134-62d4-9f649c4e709a@alibaba-inc.com> From: "Yang Shi" Message-ID: <63b69d2b-1c1d-6f08-30a6-e996b6842000@alibaba-inc.com> Date: Sun, 17 Dec 2017 06:25:17 +0800 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Arnd Bergmann Cc: Andrew Morton , Michal Hocko , "Kirill A. Shutemov" , Stephen Rothwell , Vlastimil Babka , David Rientjes , Ingo Molnar , Linux-MM , Linux Kernel Mailing List On 12/16/17 4:24 AM, Arnd Bergmann wrote: > On Fri, Dec 15, 2017 at 7:01 PM, Yang Shi wrote: >> >> >> On 12/15/17 4:51 AM, Arnd Bergmann wrote: >>> >>> When the down_read_trylock() fails, 'vma' has not been initialized >>> yet, which gcc now warns about: >>> >>> mm/khugepaged.c: In function 'khugepaged': >>> mm/khugepaged.c:1659:25: error: 'vma' may be used uninitialized in this >>> function [-Werror=maybe-uninitialized] >> >> >> Arnd, >> >> Thanks for catching this. I'm wondering why my test didn't catch it. It >> might be because my gcc is old. I'm using gcc 4.8.5 on centos 7. > > Correct, gcc-4.8 and earlier have too many false-positive warnings with > -Wmaybe-uninitialized, so we turn it off on those versions. 4.9 is much > better here, but I'd recommend using gcc-6 or gcc-7 when you upgrade, > they have a much better set of default warnings besides producing better > binary code. Thanks, I just upgraded gcc to 6.4 on my cetnos 7 machine. But, I ran into a build error with 4.15-rc3 kernel, but 4.14 is fine. I bisected to a commit in Makefile. I will email my bug report to the mailing list. Regards, Yang > > See http://git.infradead.org/users/segher/buildall.git for a simple way > to build toolchains suitable for building kernels in varying architectures > and versions. > > Arnd > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org