Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp1011553lqt; Fri, 19 Apr 2024 19:13:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWVUH3ixoiSaydxycdsiunV3TXuH14q7o0VOWG5HIFQigYPhWmwWMx7ONV7PIZz1G2gdqWiSVtamAhApKEdmY0hcJdlvb2QuLNfnvgS7w== X-Google-Smtp-Source: AGHT+IEqZzKkTQ2UbLEsTTbv6fsT1anhIA8fBU0atrd9XYWzwnp9QyhVrVY7cRvH0zFH9j2uKmLe X-Received: by 2002:a05:6a20:5505:b0:1aa:5e75:d31f with SMTP id ko5-20020a056a20550500b001aa5e75d31fmr3825178pzb.16.1713579199510; Fri, 19 Apr 2024 19:13:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713579199; cv=pass; d=google.com; s=arc-20160816; b=Ekan3HEm915gLYir82HlkPPmTDb5i9D6cz8VI14llMhn00XscNt+quxhhDnVbXWW0t dEE9i1SKqcdC/L7JAqm9Psy6tvEMq8p32miGtAzmJtWeNB5z0OQteBFgVXG2dB2BkwB9 JisvRZSK0AI1qAQrbaVRXza+TeQURGN4GoNDXEQRGE4zRY8wZkllgjGl98LOyX9PzrA1 W+UNNy62BpMPWeTYvlxWpO+I0LMQr/RoOqB4VnPqa76BLntPXvwpu31R+BI7nhvPEucD OhU0FyjEs318jTwq79DfJ6Md/KGE292xK7ntXHa2cKtHZSxah5Kb3JTV1tmK4ZRoj87/ 0GmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=WvXN7uF36IKJwsn4LY2Rn1Z5WrB//OqUYccefq6PgTw=; fh=CYmBEgQ1mKfrrFxiB6vjwmsFN2ePF7DxqvbkZGZw2/o=; b=ITxF69i3nbIOgt3vyxSigxtOzQpOHNGO9hVW/AI40sasS0MnKe2eXYwPbsW/V43J3b iG32PJWkpNofTW2uKlMDzhrVgMdR5X4ghkA5oTa3eMMZZWqLjSNuoaya6xnAApMMSQlg uGJCNdt4Pgc1l32JmBdoZnpEDD3w0gFHTCzcMo84CFJX7gWmsLMGx+0z+WiWy2NFR1kE XM7wdsw4wAQLKeWEOdbFtLnu5vhJOBTlIiDUPC32CL20O4tXiwPHfyA4dmtsaRZy1fat Pejx2mFXUlE298fGqWgtSWnY+rfzrSjSHDtLGGqwThNBkZaFFpOKjtzFhgGP1BuHKXIV FfJg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-152088-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152088-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o7-20020a17090a744700b002a52b1d6d11si5933569pjk.147.2024.04.19.19.13.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 19:13:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152088-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-152088-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152088-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 25D28281B83 for ; Sat, 20 Apr 2024 02:13:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E5165CB5; Sat, 20 Apr 2024 02:13:13 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB94010F7 for ; Sat, 20 Apr 2024 02:13:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713579193; cv=none; b=ruoAbjHADZDhwMjSIeDXi36bbDccuQxiUngnZ/il9Pj9oO5bJJ2QiIUY7NNXtq1LRsyCdfv9vU580LuhpqWtgM1OauBZ1HOUzFGwRE0kxpHXfRB0GIKh0fTniWMeROC6kuPRbIOzVv5JIoPy4/WLbFsalzwVYaJexlaMpS56PWI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713579193; c=relaxed/simple; bh=lYH2n/lx6u+DJGYnSMvCJ68VmUMqlZKofZzhtjsPZeM=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=GzxV1QFp4I+NzI4KEW+b9JYeyNnENKGHO6JOGCUru07r5zlVvonIj7SHxpp/RmbQ+SAfZmRHU0pNA62Otqa1qgZrCLOYMSB/pjVAgx3ezbDO5NAFUXCXVYLp0pKrCn0M7fiWEMNmeS+cbVgReBNIi8LW/z3hmFgibHRgr71cSMU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VLw2K3Zttzcdln; Sat, 20 Apr 2024 10:10:01 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 7FD5618006C; Sat, 20 Apr 2024 10:13:07 +0800 (CST) Received: from [10.173.135.154] (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sat, 20 Apr 2024 10:13:07 +0800 Subject: Re: [PATCH v2] mm/hugetlb: fix DEBUG_LOCKS_WARN_ON(1) when dissolve_free_hugetlb_folio() To: Andrew Morton CC: , , , , References: <20240419085819.1901645-1-linmiaohe@huawei.com> <20240419141134.464ea3a1ef3d0e93c6711c93@linux-foundation.org> From: Miaohe Lin Message-ID: <000d75f3-6e16-6b91-7657-afb954773381@huawei.com> Date: Sat, 20 Apr 2024 10:13:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240419141134.464ea3a1ef3d0e93c6711c93@linux-foundation.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500002.china.huawei.com (7.192.104.244) On 2024/4/20 5:11, Andrew Morton wrote: > On Fri, 19 Apr 2024 16:58:19 +0800 Miaohe Lin wrote: > >> When I did memory failure tests recently, below warning occurs: >> >> DEBUG_LOCKS_WARN_ON(1) >> WARNING: CPU: 8 PID: 1011 at kernel/locking/lockdep.c:232 __lock_acquire+0xccb/0x1ca0 >> Modules linked in: mce_inject hwpoison_inject >> CPU: 8 PID: 1011 Comm: bash Kdump: loaded Not tainted 6.9.0-rc3-next-20240410-00012-gdb69f219f4be #3 >> >> ... >> >> --- a/mm/hugetlb.c >> +++ b/mm/hugetlb.c >> @@ -1773,7 +1773,7 @@ static void __update_and_free_hugetlb_folio(struct hstate *h, >> * If vmemmap pages were allocated above, then we need to clear the >> * hugetlb flag under the hugetlb lock. >> */ >> - if (clear_flag) { >> + if (folio_test_hugetlb(folio)) { >> spin_lock_irq(&hugetlb_lock); >> __folio_clear_hugetlb(folio); >> spin_unlock_irq(&hugetlb_lock); > > Please let's prepare backportable fixes against current mainline, not > mm-unstable. Because fixes against current -rcX and earlier will be > upstreamed ahead of the mm-unstable and mm-stable material. Do you mean I need to send one fixup patch against mm-unstable and another one against current mainline? > > > I did this: > > --- a/mm/hugetlb.c~mm-hugetlb-fix-debug_locks_warn_on1-when-dissolve_free_hugetlb_folio > +++ a/mm/hugetlb.c > @@ -1781,7 +1781,7 @@ static void __update_and_free_hugetlb_fo > * If vmemmap pages were allocated above, then we need to clear the > * hugetlb destructor under the hugetlb lock. > */ > - if (clear_dtor) { > + if (folio_test_hugetlb(folio)) { This looks good to me. Thanks for doing this. :) Thanks. . > spin_lock_irq(&hugetlb_lock); > __clear_hugetlb_destructor(h, folio); > spin_unlock_irq(&hugetlb_lock); > _ > > . >