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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS 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 CB085C433DB for ; Wed, 17 Feb 2021 19:04:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 974286186A for ; Wed, 17 Feb 2021 19:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232498AbhBQTDi (ORCPT ); Wed, 17 Feb 2021 14:03:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:50704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231239AbhBQTDd (ORCPT ); Wed, 17 Feb 2021 14:03:33 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 90D3E6186A; Wed, 17 Feb 2021 19:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1613588572; bh=odEQGZsuO+lEqXY7esyTBK2QgwaJ1DoXNXR2BQ1SGlc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=zOE7O/FpIEoPbTe+GWOPDp8/ki03sqzNLQavTgdbhGlzxCACNYMYDEhpwElSTFUBL Yfl2GW/J+6CTXv3m9VJE3WvAMVoOeEs9OSFrC0+zD5g5d9qL7KeS4Ny3PlR9JNKEre Mxh3+R1H1GFO9zDdiQ2Egb0nNz/TTDgN7jsz0T9E= Date: Wed, 17 Feb 2021 11:02:52 -0800 From: Andrew Morton To: Mike Kravetz Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Zi Yan , Davidlohr Bueso , "Kirill A . Shutemov" , Andrea Arcangeli , Matthew Wilcox , Oscar Salvador , Joao Martins , stable@vger.kernel.org Subject: Re: [PATCH 1/2] hugetlb: fix update_and_free_page contig page struct assumption Message-Id: <20210217110252.185c7f5cd5a87c3f7b0c0144@linux-foundation.org> In-Reply-To: <20210217184926.33567-1-mike.kravetz@oracle.com> References: <20210217184926.33567-1-mike.kravetz@oracle.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; 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, 17 Feb 2021 10:49:25 -0800 Mike Kravetz wrote: > page structs are not guaranteed to be contiguous for gigantic pages. The > routine update_and_free_page can encounter a gigantic page, yet it assumes > page structs are contiguous when setting page flags in subpages. > > If update_and_free_page encounters non-contiguous page structs, we can > see “BUG: Bad page state in process …” errors. > > Non-contiguous page structs are generally not an issue. However, they can > exist with a specific kernel configuration and hotplug operations. For > example: Configure the kernel with CONFIG_SPARSEMEM and > !CONFIG_SPARSEMEM_VMEMMAP. Then, hotplug add memory for the area where the > gigantic page will be allocated. > Zi Yan outlined steps to reproduce here [1]. > > [1] https://lore.kernel.org/linux-mm/16F7C58B-4D79-41C5-9B64-A1A1628F4AF2@nvidia.com/ > > Fixes: 944d9fec8d7a ("hugetlb: add support for gigantic page allocation at runtime") June 2014. That's a long lurk time for a bug. I wonder if some later commit revealed it. I guess it doesn't matter a lot, but some -stable kernel maintainers might wonder if they really need this fix...