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=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 A5804C47089 for ; Thu, 27 May 2021 08:22:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8086861248 for ; Thu, 27 May 2021 08:22:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235412AbhE0IYC (ORCPT ); Thu, 27 May 2021 04:24:02 -0400 Received: from mx2.suse.de ([195.135.220.15]:50824 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235400AbhE0IX5 (ORCPT ); Thu, 27 May 2021 04:23:57 -0400 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=1622103744; 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=+EfkVrIQZXBeZTPSxjNuEm8wUQKfD3cTZZ/zTTMSBzw=; b=iIdOJB9ZclOzK1R83f55YqiC+wO2fih/GoA1P6TTFS7h/zJZv+/vjHUezFzt6uULVaRUNQ eLiBhU2Vt0rRbhtKjqCzvjWLKXmuXfKoUvniad9b6jcJksXd04jGHck9f8MPt9I054mw0y VQ+IuJWWlJzLeN4HCvmS7MSB1NRuQbw= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1F646AB71; Thu, 27 May 2021 08:22:24 +0000 (UTC) Date: Thu, 27 May 2021 10:22:23 +0200 From: Michal Hocko To: Oscar Salvador Cc: Naoya Horiguchi , linux-mm@kvack.org, Mike Kravetz , Muchun Song , Andrew Morton , David Hildenbrand , Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] hugetlb: pass head page to remove_hugetlb_page() Message-ID: References: <20210526235257.2769473-1-nao.horiguchi@gmail.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 Thu 27-05-21 09:47:44, Oscar Salvador wrote: > On Thu, May 27, 2021 at 08:52:57AM +0900, Naoya Horiguchi wrote: > > From: Naoya Horiguchi > > > > When memory_failure() or soft_offline_page() is called on a tail page of > > some hugetlb page, "BUG: unable to handle page fault" error can be > > triggered. > > > > remove_hugetlb_page() dereferences page->lru, so it's assumed that the > > page points to a head page, but one of the caller, > > dissolve_free_huge_page(), provides remove_hugetlb_page() with 'page' > > which could be a tail page. So pass 'head' to it, instead. > > > > Fixes: 6eb4e88a6d27 ("hugetlb: create remove_hugetlb_page() to separate functionality") > > Signed-off-by: Naoya Horiguchi > > Reviewed-by: Oscar Salvador > > It is probably worth adding a comment in remove_hugetlb_page() noting > that we need a head page, so future users do not repeat the same > mistake. Ideally this will turn into page folio concept and no comments are really needed. -- Michal Hocko SUSE Labs