Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1603094pxb; Thu, 4 Mar 2021 16:04:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwihUqxSpOvQb3YRcu87D2pSRbJBUWm0XYNUuztbegUdO7k7R+79vK9XZAmF0AOCgYEDzhF X-Received: by 2002:a05:6602:1406:: with SMTP id t6mr5827517iov.154.1614902683621; Thu, 04 Mar 2021 16:04:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614902683; cv=none; d=google.com; s=arc-20160816; b=zCEXAWL2dhcFZEuwql+e6Ky4UA04YVx/nWlM8QtRkKASl6zX3XoDL+t7YP1y1FLjYV 21anRWkzb3J9RzXKbGx7pOXbtjHBOoqvgn09VbxtEk8RjVdi2emRkAkrFrwhJwF99yps +KpVvnlOshn4e6qXQVODC9M4D1VYkzUnoP/TURv16h8OmYqbnEOT9rxPUJ9AM8WI7URp 6lEziac424tvulK0YliAr8S2pQ3/FXhaUdMT3dYQhLiSTYnTWrWDCON5wjAbcRV5FDd0 IWR8hM7ZtAyuk1wApKLiGvpE/n7430zOocSE7J/P35ewyZXn7EoC93zaD1aaJDv0PEYL TSxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=bNMnMqrp2HEKjdFiGupPYllLza/hG1Fb8IPo+AOqpUc=; b=H0IIp6hvCcSuZis2Ol2uay1nmPSHq9oZZNf3yCcKieB7zy46VesgFh0r41lzEEBPfF dldTyQxNGoFmeOzqWjfC8/J0+VJF4JSh+X2l+Eje9BAP5G8ozKobsBrC5rqX0YgtZ3sN C0r4SCUPCEADNAY16se6TWDPWEgfKo59UHkfrbxysotYx4FWaKIVrtaqYsq3gBaMC2Y4 jtuZzppKZNiALj0pOY8iKL4+r9793EsnB/Qm/6mX2hoRpwAFQW+LOmLPTGTxqZJ80efC EaDBvesqGz9H0vUXoq+BKR85cq/gHnoLBSu5dCDXZF6OQyb/xS127N3oJCEr8EKAILgL 1fwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ZugkI/Z2"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d21si890091iof.9.2021.03.04.16.04.30; Thu, 04 Mar 2021 16:04:43 -0800 (PST) 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=@gmail.com header.s=20161025 header.b="ZugkI/Z2"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235687AbhCDGpy (ORCPT + 99 others); Thu, 4 Mar 2021 01:45:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235670AbhCDGp3 (ORCPT ); Thu, 4 Mar 2021 01:45:29 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74AC9C06175F for ; Wed, 3 Mar 2021 22:44:49 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id e6so18260664pgk.5 for ; Wed, 03 Mar 2021 22:44:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bNMnMqrp2HEKjdFiGupPYllLza/hG1Fb8IPo+AOqpUc=; b=ZugkI/Z2joHxCRCkM+/RQ5AJpo78d9DlDl93uGai8iNu+80c3d7Wb5M/YaRByzQVUE Xu0p6GpnKjLMbILkC4VxBlcKR91gvuldz369B7nsxBCzPVWXVlGyDO0babgmCCUL1gkj Jayy6MyYHqbYn9dMap2Gz2IIwtZurRgu1c/FCgJ6CUTrpsef/CM9FRpxmrZmGYlacs1D DHUh0tTsKlDLgpzcqxchPm8y4TkpsjhpV8/o+blsUWKuSb2Qqw6zV7c+GcVhnkg8KRDt ObvlW+CzjrZ/gfpb9l51zayjhdGSz7GYwVCt7mrNkooVTHNz8MXE47l8Es02sdGiHf1E sApA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bNMnMqrp2HEKjdFiGupPYllLza/hG1Fb8IPo+AOqpUc=; b=j6bmLU58VNzpljeew3x5Vbs1kjugIKO4n3oZxoq72WxAH+hwg+JgImbFRgqVPjS11k U9FOsRzbE/O4mb5scxjFCDOYvNh/YxdqWQ2hM7rXnBtIi+qfKtzR9T5UHEdWkAOLZ6gY +g/9SOjvtaXNt26e5ko6haLOX/xL/fMLV4kOLS650Gx/mt4HQt01LEmLjGWVP2LisLsp wRvjw3M4JCwhzv1Ivw0UbcwF0n0WD/dHREvhQrrG2Q3lrhVczkmUvIzVCguJhoNtHiZh Th8avdlFVJ7TBdOxg82eTpwW3MzPVADIcjyrlCpV+ZRolp4dBrUNt2pn2gn7yDAJR1TC oMaw== X-Gm-Message-State: AOAM5321Og42BMNGx4250mczgS2jnGIWR2PCALh/tqrOakkD5b57qmov 66A7jeyMBFA59PnDvfb5rA== X-Received: by 2002:a05:6a00:14d5:b029:1ec:c5e5:6041 with SMTP id w21-20020a056a0014d5b02901ecc5e56041mr2388556pfu.36.1614840289043; Wed, 03 Mar 2021 22:44:49 -0800 (PST) Received: from localhost.localdomain (h175-177-040-153.catv02.itscom.jp. [175.177.40.153]) by smtp.gmail.com with ESMTPSA id z8sm8933267pjd.0.2021.03.03.22.44.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 22:44:48 -0800 (PST) From: Naoya Horiguchi To: linux-mm@kvack.org Cc: Andrew Morton , Michal Hocko , Oscar Salvador , Tony Luck , "Aneesh Kumar K.V" , Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: [PATCH v1] mm, hwpoison: do not lock page again when me_huge_page() successfully recovers Date: Thu, 4 Mar 2021 15:44:37 +0900 Message-Id: <20210304064437.962442-1-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Naoya Horiguchi Currently me_huge_page() temporary unlocks page to perform some actions then locks it again later. My testcase (which calls hard-offline on some tail page in a hugetlb, then accesses the address of the hugetlb range) showed that page allocation code detects the page lock on buddy page and printed out "BUG: Bad page state" message. PG_hwpoison does not prevent it because PG_hwpoison flag is set on any subpage of the hugetlb page but the 2nd page lock is on the head page. This patch suggests to drop the 2nd page lock to fix the issue. Fixes: commit 78bb920344b8 ("mm: hwpoison: dissolve in-use hugepage in unrecoverable memory error") Cc: stable@vger.kernel.org Signed-off-by: Naoya Horiguchi --- mm/memory-failure.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git v5.11/mm/memory-failure.c v5.11_patched/mm/memory-failure.c index e9481632fcd1..d8aba15295c5 100644 --- v5.11/mm/memory-failure.c +++ v5.11_patched/mm/memory-failure.c @@ -830,7 +830,6 @@ static int me_huge_page(struct page *p, unsigned long pfn) page_ref_inc(p); res = MF_RECOVERED; } - lock_page(hpage); } return res; @@ -1286,7 +1285,8 @@ static int memory_failure_hugetlb(unsigned long pfn, int flags) res = identify_page_state(pfn, p, page_flags); out: - unlock_page(head); + if (PageLocked(head)) + unlock_page(head); return res; } -- 2.25.1