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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 C2FBEC4707F for ; Thu, 27 May 2021 19:54:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 52FF061284 for ; Thu, 27 May 2021 19:54:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52FF061284 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 C6D9E6B006C; Thu, 27 May 2021 15:54:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C1DE36B006E; Thu, 27 May 2021 15:54:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ABEB56B0070; Thu, 27 May 2021 15:54:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0112.hostedemail.com [216.40.44.112]) by kanga.kvack.org (Postfix) with ESMTP id 7445B6B006C for ; Thu, 27 May 2021 15:54:13 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E523D813E for ; Thu, 27 May 2021 19:54:12 +0000 (UTC) X-FDA: 78188062344.18.FCAB8B5 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf12.hostedemail.com (Postfix) with ESMTP id 5140D2BD6 for ; Thu, 27 May 2021 19:54:01 +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=1622145251; 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=mxtUZSqaXY8XU4F0jZiCtJarRMKlJKSJank0/DGF1qE=; b=jft1LIQuYeIRXNbtKljIzon9kwDrYp1ebHG3kXcY+2m7xpCf6aRtAHUwiCw32S+CvyHC70 SvzxAV5T1N7AsYidRphEY7x3Wd5UV2ksctBRPd5QQG2jRJUp/PteNDjrUifMgFwJyM3+Ye HUUc++LUS0/nTDYdQhYMJPIHm0fJFsg= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id F02F2AE99; Thu, 27 May 2021 19:54:10 +0000 (UTC) Date: Thu, 27 May 2021 21:54:10 +0200 From: Michal Hocko To: Mike Kravetz Cc: Naoya Horiguchi , linux-mm@kvack.org, Oscar Salvador , 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> <2097f731-0b72-a5bc-1011-09447089a81b@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2097f731-0b72-a5bc-1011-09447089a81b@oracle.com> X-Rspamd-Queue-Id: 5140D2BD6 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=jft1LIQu; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf12.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.15 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Rspamd-Server: rspam03 X-Stat-Signature: en9hazs9c84ysfquu4gzispgj4h633s5 X-HE-Tag: 1622145241-106060 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 Thu 27-05-21 09:28:51, Mike Kravetz wrote: > On 5/26/21 4:52 PM, 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 > > --- > > mm/hugetlb.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git v5.13-rc3/mm/hugetlb.c v5.13-rc3_patched/mm/hugetlb.c > > index 95918f410c0f..470f7b5b437e 100644 > > --- v5.13-rc3/mm/hugetlb.c > > +++ v5.13-rc3_patched/mm/hugetlb.c > > @@ -1793,7 +1793,7 @@ int dissolve_free_huge_page(struct page *page) > > SetPageHWPoison(page); > > ClearPageHWPoison(head); > > } > > - remove_hugetlb_page(h, page, false); > > + remove_hugetlb_page(h, head, false); > > h->max_huge_pages--; > > spin_unlock_irq(&hugetlb_lock); > > update_and_free_page(h, head); > > > > I believe we have the same problem later in the routine when calling > add_hugetlb_page()? Can we ever get a tail page there? > If so, should we combine the changes? Or, do we need two patches as > the bugs were introduced with different commits? If there is an issue then I would go with a separate patch. Thanks! -- Michal Hocko SUSE Labs