Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6397168imu; Wed, 14 Nov 2018 00:24:18 -0800 (PST) X-Google-Smtp-Source: AJdET5d6P6cAJDcjQl3NKfJdWV7WXiRJ+IhB/0s2CARfwkwohRWut25R4OtcyXxVT7In7EBRJyKe X-Received: by 2002:a63:c0f:: with SMTP id b15mr893905pgl.314.1542183857964; Wed, 14 Nov 2018 00:24:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542183857; cv=none; d=google.com; s=arc-20160816; b=ua02Bro6X5yTgW7xdmd0Jt5wyeEOKHfhMMBST+vhOxf8QBp2/o5FHSOuZVgeQGoEaN NvOSorqVIP76HagkPw5DDNqzE3ZNWwFG9x910zCytZ8Fi3nbt6PNp3bjZfNWmgGS9B2t NwCdn59eUaMx8eiRKPKsW51hrqLXi9vKcyP07p7PFMrtEbYXQriDgRL/zYDgb9on+l+s ww34D3GzftkmA6y0u3hD8wd4CRbxDETtDoZqCVRe58wlk0b6qVg1gjDue4ppgiT1e43n ta4ZY8oBoMyz45vvGJ/Newrw7iSTaaOkhkG8gqeeSFJhl1cLnnPjDsL9Zyjb0SgXP3kJ mtLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=yCDjH+bW8Nq1IYCamxve7iKOqBE+9iwLCOzX1iVGp38=; b=baM6rpYKEBa+Byain+cd7t+sJVphqLQoZQesh67CGmL23u9I/Zknxo7l9pGlkMETIe 2nVNeqg89TY4fGjt8u1bu36Ue9Vudo9Is0+Nfe5qgcmZS7qiWSdx2+SoQgSyb86i/RrP D8ISugXkKeF0+ehdK5DjfctL5Tx+1fHwnS/JwdVJ+jnqYoVI6KA16xsHza38st1zjwGG GcsyLxEQkyb8pijXgF/bClbA0FXjlNLeqzMrEr2041HCaePDicfZSyIB8kRhDMbVoEvi WBwChnDuOI4SlreNCNiVxbZC6Z4RaG95oqaBKebotsEeU4cl5mR7EEvrYPx8k79DW8RJ ltuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z61-v6si23938381plb.46.2018.11.14.00.24.02; Wed, 14 Nov 2018 00:24:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732325AbeKNSZV (ORCPT + 99 others); Wed, 14 Nov 2018 13:25:21 -0500 Received: from foss.arm.com ([217.140.101.70]:39688 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730764AbeKNSZV (ORCPT ); Wed, 14 Nov 2018 13:25:21 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D3983EBD; Wed, 14 Nov 2018 00:23:09 -0800 (PST) Received: from [10.162.0.72] (unknown [10.162.0.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 884BF3F5CF; Wed, 14 Nov 2018 00:23:07 -0800 (PST) Subject: Re: [RFC][PATCH v1 11/11] mm: hwpoison: introduce clear_hwpoison_free_buddy_page() To: Naoya Horiguchi Cc: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Michal Hocko , Andrew Morton , Mike Kravetz , "xishi.qiuxishi@alibaba-inc.com" , Laurent Dufour References: <1541746035-13408-1-git-send-email-n-horiguchi@ah.jp.nec.com> <1541746035-13408-12-git-send-email-n-horiguchi@ah.jp.nec.com> <20181113001907.GD5945@hori1.linux.bs1.fc.nec.co.jp> From: Anshuman Khandual Message-ID: Date: Wed, 14 Nov 2018 13:53:04 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181113001907.GD5945@hori1.linux.bs1.fc.nec.co.jp> Content-Type: text/plain; charset=iso-2022-jp Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/13/2018 05:49 AM, Naoya Horiguchi wrote: > On Fri, Nov 09, 2018 at 05:03:06PM +0530, Anshuman Khandual wrote: >> >> >> On 11/09/2018 12:17 PM, Naoya Horiguchi wrote: >>> The new function is a reverse operation of set_hwpoison_free_buddy_page() >>> to adjust unpoison_memory() to the new semantics. >>> >>> Signed-off-by: Naoya Horiguchi >> >> snip >> >>> + >>> +/* >>> + * Reverse operation of set_hwpoison_free_buddy_page(), which is expected >>> + * to work only on error pages isolated from buddy allocator. >>> + */ >>> +bool clear_hwpoison_free_buddy_page(struct page *page) >>> +{ >>> + struct zone *zone = page_zone(page); >>> + bool unpoisoned = false; >>> + >>> + spin_lock(&zone->lock); >>> + if (TestClearPageHWPoison(page)) { >>> + unsigned long pfn = page_to_pfn(page); >>> + int migratetype = get_pfnblock_migratetype(page, pfn); >>> + >>> + __free_one_page(page, pfn, zone, 0, migratetype); >>> + unpoisoned = true; >>> + } >>> + spin_unlock(&zone->lock); >>> + return unpoisoned; >>> +} >>> #endif >>> >> >> Though there are multiple page state checks in unpoison_memory() leading >> upto clearing HWPoison flag, the page must not be in buddy already if >> __free_one_page() would be called on it. > > Yes, you're right. > clear_hwpoison_free_buddy_page() is intended to cancel the isolation by > set_hwpoison_free_buddy_page() which removes the target page from buddy allocator, > so the page clear_hwpoison_free_buddy_page() tries to handle is not a buddy page > actually (not linked to any freelist). Got it. Thanks for the explanation.