Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp339316pxb; Wed, 24 Feb 2021 03:42:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyPpzZK8NYWaaPcYf6Vx26/d7hoqGNR1Mgw2DlyZvSFyDRI7nMM15i78HQ/Q4fUdzB6Qlr X-Received: by 2002:a05:6402:22d0:: with SMTP id dm16mr32820042edb.370.1614166962586; Wed, 24 Feb 2021 03:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614166962; cv=none; d=google.com; s=arc-20160816; b=L9uXc08Lqfoe5/+UYAHOg61GmWRWNDmmpgDzim7EGaVhsygtZRq+JArh59D9EsVSPT 3HTkc6l/BgG5DYjty8mzY8QbD4tyvSlvwx3RXLwQYfjSWv+BBaAR06thVCqN48KEezpJ NctycVFyTlxdsoldMhQpYHC85hOhzB3EO6vUcidw36b2TvVDbrk/2fdOipSzl/YeB8TT I9brjmislearyRcCWq7PskoEO+tZdednZybPLELV4/sN9E7oUGj0vMk3BH7yHvHnncFr yEyeU2a2duI5ltfpTILVUf8uTbi0aEKrgxGt9CPE+ORAg9hWdecV9ZxTjupAMkohQZUY tytg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0541fh0BrcejOOEU1ZwkNGq54Tbr8fji1MTShXhrzVs=; b=XmEJwpsRmbqfF8hg4no4mRqUJTWOliOtlRcM7OeTf4uGe1CDP3HKZKuDFkndtI2+LP hUqxKJ4Dn+/naIH+LtFPbBijnpofcbij4EX+F6WC4ripktdC+mlLEPxnvpF49lL8KaGk hYR8MXeZW1LsSBlCi6hd2joJ90RVuGhkuW6scQd0FUMY65QqOoM+3+2p0zuVJwIw+4Ox 3qhmN1FEid+Qdw/3fCICKyW6v7vyVps2QwSUhPu0/D+2Y0Kyjmw5zpBYZxUvv/0j4Ksm ZDoKBX4N2EBRRnBkwWP8u9vbS7CCWUD0XbVYnE0dSey3HMnRRZRs8fiAkM6rCFnVe+SP ER1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=t4nsHb6I; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cc7si905465edb.462.2021.02.24.03.42.18; Wed, 24 Feb 2021 03:42:42 -0800 (PST) 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=@suse.com header.s=susede1 header.b=t4nsHb6I; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234255AbhBXLh2 (ORCPT + 99 others); Wed, 24 Feb 2021 06:37:28 -0500 Received: from mx2.suse.de ([195.135.220.15]:45872 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234970AbhBXLhS (ORCPT ); Wed, 24 Feb 2021 06:37:18 -0500 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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