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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B902C433F5 for ; Sat, 9 Apr 2022 02:05:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C99DD6B0071; Fri, 8 Apr 2022 22:05:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C22686B0073; Fri, 8 Apr 2022 22:05:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A9BB16B0074; Fri, 8 Apr 2022 22:05:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 939906B0071 for ; Fri, 8 Apr 2022 22:05:02 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 34428603C5 for ; Sat, 9 Apr 2022 02:05:02 +0000 (UTC) X-FDA: 79335697644.16.4772029 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf31.hostedemail.com (Postfix) with ESMTP id 2962020002 for ; Sat, 9 Apr 2022 02:05:01 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KZz236mNczdZq6; Sat, 9 Apr 2022 10:04:11 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 9 Apr 2022 10:04:41 +0800 Subject: Re: [PATCH v8 2/3] mm/hwpoison: put page in already hwpoisoned case with MF_COUNT_INCREASED To: Naoya Horiguchi CC: Andrew Morton , Mike Kravetz , Yang Shi , Dan Carpenter , Naoya Horiguchi , , Linux-MM References: <20220408135323.1559401-1-naoya.horiguchi@linux.dev> <20220408135323.1559401-3-naoya.horiguchi@linux.dev> From: Miaohe Lin Message-ID: <84062e94-8356-a2b2-1074-e0143297223e@huawei.com> Date: Sat, 9 Apr 2022 10:04:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20220408135323.1559401-3-naoya.horiguchi@linux.dev> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: b843aopuszemx9jrwrt89ed38bbau34r Authentication-Results: imf31.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf31.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Queue-Id: 2962020002 X-HE-Tag: 1649469901-987734 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2022/4/8 21:53, Naoya Horiguchi wrote: > 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). IMHO, this issue will lead to memoryleak as page isn't freed even owner process is killed. So we might need a Fixes tag? Anyway, this patch looks good to me. Thanks! Reviewed-by: Miaohe Lin > > 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; > } > >