Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp981325pxj; Thu, 27 May 2021 16:56:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBHwugkGZN40W+TZEJ/gaNoY2hvFXD0RkLFWp40vmDoTcVCqHHn5v0Wdalr88siS7xn2hd X-Received: by 2002:a17:906:1d0a:: with SMTP id n10mr6382635ejh.341.1622159771035; Thu, 27 May 2021 16:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622159771; cv=none; d=google.com; s=arc-20160816; b=OjH/5ZhfAjgmadiJPufg5i81iOuEhuiMEIxAFlZmjo5AyJ/kodWh2G/Y2AEdJUib2z hcJ+i9Ckxy6HfS0BSTC/We0QDgrih0fRCqtVQL9KYsG+WztAb97kWZDxvMLrgpRGZ71x sqGA2tJIS6Neo80VD9js3paJGSFwDISHru+Uw4RK1GF6HmfBlSpsNk6ZpHmJIiXevWsd MmBUL3GKAVn752DsEIrAydMhAvpffsV9x/CZWf8rmmN6vFCke1Qjgm2xXREOirMuN7L5 0Ok4RpulzpG5G/RYDWFHsyAkcNRF9TX0ww1NsXOjnfxsoDZn1Hn2u/CrFbl3NSdIArA8 0jQA== 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=mxtUZSqaXY8XU4F0jZiCtJarRMKlJKSJank0/DGF1qE=; b=v/C9BADM/WK77YMZM8Hit66nZAlKZyiZQlUpLgZeABItpD6gG3WyVIE+2AzeOM7/+0 97Xo8oyw3gPjzJ0euFhFP1g4sbWzW9Lq4SRP9zI1eRhins1L3+PZcI/8IUI1izWZLiVB cvNv7z4+NdLMh0XLXk+WhhA/644pGEWDF0yMitRZXtpvGk/7jEWwYw28f/csjiq+ce0l WtohfL9nuZ/RbRh2uSrbZ0SU26xSv/g2tZE23fkqfJavyixOK1hP9mSTKQP9gIN+O+Xr KIzTIIF4IVLolkUwFqCdTMcndkCEQHxlp92kH5xAP/JSR1PhOkrZsUwPtaXQL//1Mq/Z gCNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=jft1LIQu; 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 l1si3278034edq.336.2021.05.27.16.55.47; Thu, 27 May 2021 16:56:11 -0700 (PDT) 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=jft1LIQu; 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 S234994AbhE0Tzq (ORCPT + 99 others); Thu, 27 May 2021 15:55:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:47710 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234586AbhE0Tzp (ORCPT ); Thu, 27 May 2021 15:55:45 -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=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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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