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.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 83982C433E0 for ; Wed, 24 Feb 2021 11:36:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D0DA160C3E for ; Wed, 24 Feb 2021 11:36:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D0DA160C3E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id ED33E6B0006; Wed, 24 Feb 2021 06:36:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E5BCD6B006C; Wed, 24 Feb 2021 06:36:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D4CFB6B006E; Wed, 24 Feb 2021 06:36:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id BAB056B0006 for ; Wed, 24 Feb 2021 06:36:33 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7EBEB180B372C for ; Wed, 24 Feb 2021 11:36:33 +0000 (UTC) X-FDA: 77852958666.15.BDBD6E6 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf19.hostedemail.com (Postfix) with ESMTP id 4635D90009F0 for ; Wed, 24 Feb 2021 11:36:29 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1614166591; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0541fh0BrcejOOEU1ZwkNGq54Tbr8fji1MTShXhrzVs=; b=t4nsHb6IxWwH+2Y3foM95FqT/cti2mxfXB6ltZyHOInHU6SC3EJ74DIkngi9TcsckOUIWD zHeqF8VUevSWaZsgXHO59UyyQnsuPD4c3tOf978cpczTn7uzOC62QH5qxk+IPUyihg6mCh JBHIQEi9tvsmeMCayOPVO3zBVxeKohA= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A9164ADDC; Wed, 24 Feb 2021 11:36:31 +0000 (UTC) Date: Wed, 24 Feb 2021 12:36:30 +0100 From: Michal Hocko To: Muchun Song Cc: Mike Kravetz , LKML , Linux Memory Management List , Gerald Schaefer , Oscar Salvador , Heiko Carstens , Sven Schnelle , Andrew Morton Subject: Re: [External] Re: [PATCH] hugetlb: fix uninitialized subpool pointer Message-ID: References: <20210223215544.313871-1-mike.kravetz@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: 9uzep8jsew1y44h45nz8hij3qjney4ur X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 4635D90009F0 Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614166589-522259 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 Wed 24-02-21 19:10:42, Muchun Song wrote: > On Wed, Feb 24, 2021 at 5:43 PM Michal Hocko wrote: > > > > On Tue 23-02-21 13:55:44, Mike Kravetz wrote: > > > Gerald Schaefer reported a panic on s390 in hugepage_subpool_put_pages() > > > with linux-next 5.12.0-20210222. > > > Call trace: > > > hugepage_subpool_put_pages.part.0+0x2c/0x138 > > > __free_huge_page+0xce/0x310 > > > alloc_pool_huge_page+0x102/0x120 > > > set_max_huge_pages+0x13e/0x350 > > > hugetlb_sysctl_handler_common+0xd8/0x110 > > > hugetlb_sysctl_handler+0x48/0x58 > > > proc_sys_call_handler+0x138/0x238 > > > new_sync_write+0x10e/0x198 > > > vfs_write.part.0+0x12c/0x238 > > > ksys_write+0x68/0xf8 > > > do_syscall+0x82/0xd0 > > > __do_syscall+0xb4/0xc8 > > > system_call+0x72/0x98 > > > > > > This is a result of the change which moved the hugetlb page subpool > > > pointer from page->private to page[1]->private. When new pages are > > > allocated from the buddy allocator, the private field of the head > > > page will be cleared, but the private field of subpages is not modified. > > > Therefore, old values may remain. > > > > Very interesting. I have expected that the page->private would be in a > > reasonable state when allocated. On the other hand hugetlb doesn't do > > __GFP_COMP so tail pages are not initialized by the allocator. > > It seems that the buddy allocator does not initialize the private field > of the tail page even when we specify __GFP_COMP. Yes it doesn't. What I meant to say is that even if it did a lack of __GFP_COMP would result in not doing so. I do not remember why hugetlb doesn't use __GFP_COMP but I believe this was never the case. -- Michal Hocko SUSE Labs