Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2478437pxj; Sat, 19 Jun 2021 13:38:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLmW+YCUfGpGsN7o/zd8/eVpLaseKRWuoeCUah55wSY51ATNcK/AnhebYfCx0PT/O5zCOG X-Received: by 2002:aa7:c0da:: with SMTP id j26mr12191946edp.38.1624135120576; Sat, 19 Jun 2021 13:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624135120; cv=none; d=google.com; s=arc-20160816; b=ZuTxZZLKivHz6S9U8FgzBRU38YYe+Cx/czAwIjol6wQd2w3EKae4jnI73WYxBYxqSE x2DwVhOUwshKJjL2elJXcwHo8leztDxGnWHTqRnK2RoP4cshCPFKbzXYzrbywn81Qj2R 1P9/PC51D+EF4LgadZ4n2lBtPABeNH+uM15QNWqP26sPDEJ/hiw3YdyCJihaOmJousqV iVAgCbfyHiNW1djHfgN7S7Hb1jzF1P3GFSZPcbjKgUIXDWG9Z74wNWQHgvZPIjyMJFed 2m/BAK/qAF+1ZftIDp0lCN9e1id3WJ+MvQLPsw1QF0AZXcLSigdl42vFMVHUMZsrY+WC iM4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=XGVl0FayDImKOaRmChjBnk3+gDUHWKcLVgxNLOn4sZQ=; b=G4oQZj7fl5xA/oUapOw2d2eZkKkTRFizeLBCwCpv13b7uU3Uvq5bf2fYKx59q8/nSQ Dn/U15Li0s0VoK3Wcamb3vJ2wcOd2OsQzwfrwyo8KB1/HyzcAn9kbPkW6sGD17JdAkUy DdwoU5aWYAO9iK9eoKU5lOEjTQV69cdq+B8pqkGexZ7VTPr4U7X2f6NGbYWk1brZoVyK WhqqyPGYAEi1ICxcF4g2siN0S2apkMszNk1pZ10BqyfG0wjhRMg8259eYfeEXqsh3MQO 4vYquMpc8O59KuV8FsUNTLbm3UJdSeUigPdI7sKFA68ulP8ot0Io6o6X4PN9BwYke/HX pskA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=sangfor.com.cn Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rn17si6059018ejb.11.2021.06.19.13.38.18; Sat, 19 Jun 2021 13:38:40 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=sangfor.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234093AbhFSMZy (ORCPT + 99 others); Sat, 19 Jun 2021 08:25:54 -0400 Received: from mail-m118208.qiye.163.com ([115.236.118.208]:46848 "EHLO mail-m118208.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234066AbhFSMZx (ORCPT ); Sat, 19 Jun 2021 08:25:53 -0400 Received: from 2CD-RMPB.local (unknown [113.118.120.96]) by mail-m118208.qiye.163.com (Hmail) with ESMTPA id DEC93E01C3; Sat, 19 Jun 2021 20:23:36 +0800 (CST) Subject: Re: [PATCH v1 6/6] mm/hwpoison: fix unpoison_memory() To: =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= Cc: Naoya Horiguchi , "linux-mm@kvack.org" , Andrew Morton , David Hildenbrand , Oscar Salvador , Michal Hocko , Tony Luck , "Aneesh Kumar K.V" , "linux-kernel@vger.kernel.org" References: <20210614021212.223326-1-nao.horiguchi@gmail.com> <20210614021212.223326-7-nao.horiguchi@gmail.com> <94984984-f123-85ae-20bc-b40e90d536f6@sangfor.com.cn> <20210618083625.GA2215283@hori.linux.bs1.fc.nec.co.jp> From: Ding Hui Message-ID: Date: Sat, 19 Jun 2021 20:22:32 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20210618083625.GA2215283@hori.linux.bs1.fc.nec.co.jp> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZGhpJS1ZCH0xMHU4fSUpDS09VEwETFhoSFyQUDg9ZV1kWGg8SFR0UWUFZT0tIVUpKS0 hKTFVLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6OBA6GBw5ST9DUTpKPyk6ODpW HigaCi9VSlVKTUlPSktOT0pMTkhCVTMWGhIXVR8SFRwTDhI7CBoVHB0UCVUYFBZVGBVFWVdZEgtZ QVlKSkhVSkpDVUpJS1VCTVlXWQgBWUFPQ01PNwY+ X-HM-Tid: 0a7a2439fa1f2c17kusndec93e01c3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/6/18 4:36 下午, HORIGUCHI NAOYA(堀口 直也) wrote: > On Thu, Jun 17, 2021 at 06:00:21PM +0800, Ding Hui wrote: >> On 2021/6/14 10:12, Naoya Horiguchi wrote: >>> From: Naoya Horiguchi >>> >>> After recent soft-offline rework, error pages can be taken off from >>> buddy allocator, but the existing unpoison_memory() does not properly >>> undo the operation. Moreover, due to the recent change on >>> __get_hwpoison_page(), get_page_unless_zero() is hardly called for >>> hwpoisoned pages. So __get_hwpoison_page() mostly returns zero (meaning >>> to fail to grab page refcount) and unpoison just clears PG_hwpoison >>> without releasing a refcount. That does not lead to a critical issue >>> like kernel panic, but unpoisoned pages never get back to buddy (leaked >>> permanently), which is not good. >> >> As I mention in [1], I'm not sure about the exactly meaning of "broken" in >> unpoison_memory(). >> >> Maybe the misunderstanding is: >> >> I think __get_hwpoison_page() mostly returns one for hwpoisoned page. >> In 06be6ff3d2ec ("mm,hwpoison: rework soft offline for free pages"), >> page_handle_poison() is introduced, it will add refcount for all >> soft-offlineed hwpoison page. >> In memory_failure() for hard-offline,page_ref_inc() called on free page >> too, and for used page, we do not call put_page() after get_hwpoison_page() >> != 0. >> So all hwpoisoned page refcount must be great than zero when >> unpoison_memory() if regardless of racy. > > Hi, Ding, > > Thanks for the comment. I feel that I failed to define the exact issue in > unpoison. Maybe I saw and misinterpreted some random error as unpoison's > issue during developing other hwpoison patches, so please don't take serious > my previous wrong word "broken", sorry about that. > > Anyway I reconsider how to handle this 6/6, maybe it will be a clear > description of the problem, and will be simplified. > >> >> Recently I tested loop soft-offline random pages and unpoison them for days, >> it works fine to me. (with bac9c6fa1f92 patched) > > Thank you for testing, > Hi Naoya, I'm afraid of my description about testing is ambiguous for others, let me clarify that I ran stress soft-offline test case from mce-test project (https://git.kernel.org/pub/scm/utils/cpu/mce/mce-test.git) for days to verify my modify about NR_FREE_PAGES (bac9c6fa1f92), without your current patchset, the case is loop soft-offline random pages and unpoison them, and it works basic fine to me. -- Thanks, -dinghui