From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07142C433F5 for ; Fri, 8 Apr 2022 13:53:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235683AbiDHNzv (ORCPT ); Fri, 8 Apr 2022 09:55:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236556AbiDHNzl (ORCPT ); Fri, 8 Apr 2022 09:55:41 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AAAC1FCED for ; Fri, 8 Apr 2022 06:53:36 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1649426015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k5tFbU7BShyxeb1PXfEKBF6QTN+g39+2tO6/MCWhE0c=; b=uldKYj8wYfWzhPi+3mWtIYdcWHYJvIuyo9pyhadY1DxD+CHAWwh99kvT69HCH0FtdHMz4p DmGE/mw8ipjSFz4ig7FL0jCVxU0w9aUAfSVFqjg1kUJ3dZV0pjtDEzH7uRPcdOrpsn1Oi+ 32fBpogOy6U2CABsEBk5k8QuMihJDcM= From: Naoya Horiguchi To: linux-mm@kvack.org Cc: Andrew Morton , Mike Kravetz , Miaohe Lin , Yang Shi , Dan Carpenter , Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: [PATCH v8 2/3] mm/hwpoison: put page in already hwpoisoned case with MF_COUNT_INCREASED Date: Fri, 8 Apr 2022 22:53:22 +0900 Message-Id: <20220408135323.1559401-3-naoya.horiguchi@linux.dev> In-Reply-To: <20220408135323.1559401-1-naoya.horiguchi@linux.dev> References: <20220408135323.1559401-1-naoya.horiguchi@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Naoya Horiguchi In already hwpoisoned case, memory_failure() is supposed to return with releasing the page refcount taken for error handling. But currently the refcount is not released when called with MF_COUNT_INCREASED, which makes page refcount inconsistent. This should be rare and non-critical, but it might be inconvenient in testing (unpoison doesn't work). Suggested-by: Miaohe Lin Signed-off-by: Naoya Horiguchi --- mm/memory-failure.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 2020944398c9..b2e32cdc3823 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1811,6 +1811,8 @@ int memory_failure(unsigned long pfn, int flags) res = -EHWPOISON; if (flags & MF_ACTION_REQUIRED) res = kill_accessing_process(current, pfn, flags); + if (flags & MF_COUNT_INCREASED) + put_page(p); goto unlock_mutex; } -- 2.25.1