Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp602655pxj; Thu, 27 May 2021 07:36:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOWclBVtoje1GKcPoigjr31fZXnUoMf/oYM4gLFHJWYGmsn9Bqnqwhv/TUIFWTObJtVAJk X-Received: by 2002:a02:c98a:: with SMTP id b10mr3829492jap.103.1622126185482; Thu, 27 May 2021 07:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622126185; cv=none; d=google.com; s=arc-20160816; b=QIp9gmFMfky7MsuMpkH+LLT/Kx0fzqOts71MCkDRhcPL49+nWNKg/gzmAwcC+w+Xad j6gKjP5F6FwxUxcdhKC5FzwYf+iES8pstgNB0J5VSc0/uMJud3Pcw7Iq/tSRVvtQ6E5t 0tWka3P20QjLE8FA0Nb4rUklu4GAM7eYdgHLOrQpwTPf3XZyPxXSs89bdSM98R1X0PSg 2e+Ur6mXSSpRTei1Wnjr2ghLr3p1cvOQwhREWwOxWcQEfwx6RWxc2L2JdziOoIiV25fq nYMH3gumRNxINUxCghFTrgDWEIf2efbGYap6voyIcD7Bkjk3fTWgw52TpSe0WFKvEXUo SZHg== 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=uxrs8M1VcmOkWe5QS1sYN9XeLXXiQYAcgHDyySYmn3o=; b=nmn+ybEVqArcvrAPAS/Hs+ng5AwiJlTFk+uQzMpJ14rTE/HJlr6XYoVupVgeO3Oi6/ EfIA2pR0Xol/uPufzpNb1si8MT9CypXJt5lYat+7jIcW0SUWbNw25fgWxoQ88h31jzwG SuSjeYNapMT6RqgMigAC+hJONnPUr3l9nl8bv7owxwpqjhgSz0tGBFy+f3ouYtViQHJt bQyH09/D3iWOFFgMh2A5kYgQPDiGNMS1RTt2W7iKSd0BwEGvvjM21JqcB7p9LcIM661s ioEYsyp0Kz811+OgcEjcCmYZSmO7ihihbs/XJP+qyEs5s/FWfC7LWFB32iGEqRZ7ZG4w QnQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=VrpVpLUU; 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 t10si2226239ilj.54.2021.05.27.07.36.11; Thu, 27 May 2021 07:36:25 -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=VrpVpLUU; 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 S233315AbhE0HAe (ORCPT + 99 others); Thu, 27 May 2021 03:00:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:47218 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232416AbhE0HAd (ORCPT ); Thu, 27 May 2021 03:00:33 -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=1622098740; 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=uxrs8M1VcmOkWe5QS1sYN9XeLXXiQYAcgHDyySYmn3o=; b=VrpVpLUUEkIXq9cy0/Zr2kQ/8uNCwvou43vAx+4y5SCB//YS6drYFIn5EMqlzdf5dKLSZz hMsx2x8GEVQCUYSX5dYxr1x68FLyoTVnKfk7OY2ong3vMG21lT+67g80OeggobJzzXrSXb 0IPD7j/Qu/bea5JtL3YYZXq+mUL3fgw= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 41A90ADFB; Thu, 27 May 2021 06:59:00 +0000 (UTC) Date: Thu, 27 May 2021 08:58:59 +0200 From: Michal Hocko To: Naoya Horiguchi Cc: linux-mm@kvack.org, Mike Kravetz , 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210526235257.2769473-1-nao.horiguchi@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 27-05-21 08:52:57, 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 This is really nasty and easy to overlook. I have completely missed that when reviewing and I do remember checking for head vs page as there is quite some non trivial handling of both here. Acked-by: Michal Hocko Thanks! > --- > 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); > -- > 2.25.1 -- Michal Hocko SUSE Labs