Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp124781pxj; Thu, 10 Jun 2021 16:53:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJ0gWt8hSGr5VUXe6Uwe/WGPmp/tgHb48y7RS7R3sDRnHm5rWUgOCq6ZrbaYz44Efr+Ocp X-Received: by 2002:a17:906:d0da:: with SMTP id bq26mr866959ejb.287.1623369181957; Thu, 10 Jun 2021 16:53:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623369181; cv=none; d=google.com; s=arc-20160816; b=kXtQNRdlANfeLTd6Xc19zBd+6u1nXw/TJ+Wzh2sSoTVESjg/bXfQeXz3+u+jVZv90E jOh8BtpCBQAfngbIRaR8ax1G+RrZ1XdLSQ8xMwoWtvtbSMLuBplTChbRCjH7CqItmp83 vSsDsfITWbf4D57oyeN13R+DcPC1QGQdcLx39K0Hu+nEOIODWfJLe4jIHmCQ8RXAvaIm T28c77ZhiC6C+u3iUn5YPo88Wted3qi/NQaZ7lupqPHwmjw51j50kjUJEgUlVjc2mooE i4r3cUvhnJDCyvSDcA2F17DmZuPT8zobpXzjVVFTYthf4sMLcD4H22TiH4tjpxj12AIq fgxQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ljEXphGHeNLIv7jZL2EwSs84GptSdSVLr0TibvDZvyo=; b=lGFPSS2w57cIc3LkzD7xRxnf/V9K7xMs9e7yWdsPT00QY097V2ElfL6/Z13WSYzuLZ IY25U8Z4R1NN64ysvpy3Qdga40wfk5YQnJpt+1q8F0KWHFYWv/8Cz84pF3sBHtlO0gXV rro0WU7j6/6Tw0S08HqPU4e76F+nL5+ewPeKGpd4G3MPz0gbVucUqMH39KJ6a/qFEXIv T3QW5YGQCBQF5gGUaxq/LqK7QS8WLcRmGf9OOUuJFGIfw8m30YSvxYDU9mJhnYEDKPxT yHO6ifyZGh3Hpvr0Pzuqi9Gbz3XHmZH+AnHd7XsyJz2ZbjhWN0Fw9DEeadC66E5mERDj SVdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=1hl+iDvO; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nd28si3235956ejc.701.2021.06.10.16.52.38; Thu, 10 Jun 2021 16:53:01 -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=@linux-foundation.org header.s=korg header.b=1hl+iDvO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230434AbhFJXw5 (ORCPT + 99 others); Thu, 10 Jun 2021 19:52:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:33724 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229578AbhFJXw5 (ORCPT ); Thu, 10 Jun 2021 19:52:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E7D2F6136D; Thu, 10 Jun 2021 23:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1623369060; bh=iwUAIwA2W61o1prvvamdUIf6AtaFz5r7O1ts0WnAZvs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=1hl+iDvOesB0fP8b2CzjhanTWLNZOLkfRKgOqgpfhGZM15tqXB+coZwUEFJ2lASH/ XRLZjV1KhdbNKDn1pEge5HGh0MSAlnXvhQiELoSAsV6sFnPd/MbX1Qz8koYfTmJ/21 p61OmRf9ebrOMJdCoGcgNkHPV/mSGJTsF2RpdD3k= Date: Thu, 10 Jun 2021 16:50:59 -0700 From: Andrew Morton To: Naoya Horiguchi Cc: linux-mm@kvack.org, Linus Torvalds , Oscar Salvador , Michal Hocko , Tony Luck , "Aneesh Kumar K.V" , Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] mm/hwpoison: do not lock page again when me_huge_page() successfully recovers Message-Id: <20210610165059.6618498250f60674c1bb9c03@linux-foundation.org> In-Reply-To: <20210609072029.74645-1-nao.horiguchi@gmail.com> References: <20210609072029.74645-1-nao.horiguchi@gmail.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 9 Jun 2021 16:20:29 +0900 Naoya Horiguchi wrote: > 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 this page lock on buddy > page and printed out "BUG: Bad page state" message. > > check_new_page_bad() does not consider a page with __PG_HWPOISON as bad > page, so this flag works as kind of filter, but this filtering doesn't > work in this case because the "bad page" is not the actual hwpoisoned > page. So stop locking page again. Actions to be taken depend on the > page type of the error, so page unlocking should be done in ->action() > callbacks. So let's make it assumed and change all existing callbacks > that way. I'm getting a reject against Linus mainline here, and a -stable patch doesn't want such things happening. --- mm/memory-failure.c +++ mm/memory-failure.c @@ -1782,6 +1796,8 @@ int memory_failure(unsigned long pfn, int flags) identify_page_state: res = identify_page_state(pfn, p, page_flags); + mutex_unlock(&mf_mutex); + return res; unlock_page: unlock_page(p); unlock_mutex: and... That mutex_unlock() looks odd. The patch adds no matching mutex_lock?