Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2275071ybi; Mon, 17 Jun 2019 01:52:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6/dCN0U4UcN+vYl/eIkmdR2h6ln7t10V937R4XfCYMQ2IZDeNrZsi4ymuxQ6WzXEDeVcc X-Received: by 2002:a17:90a:778c:: with SMTP id v12mr21522538pjk.141.1560761540945; Mon, 17 Jun 2019 01:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560761540; cv=none; d=google.com; s=arc-20160816; b=NnP84nrPNCS7FvviicN9RvwxLj7GgfQ5p2FGdJBVi0rDDRvWT9Zeurh8rmm3gH/Rdm y0ejo2vieRygoxeWCIKuApOdIlidm0Wh5YyqIyiQ/7Hr7Xs1SieyJscajJAwG7T1fgzs Qy18FwspFEQFxKu3m+9YSL9rdA/QmZYhv16gTLZ6Spd3H7iXTXMriMvJqjB4RILZh1MI p4OmpIoVaDsMXpLvr/egTVr8GJ7yO1jlvolFUJjBLO5/8V0b7qLGB77NrFm12QDEB9PE kzeWj6QefuoPvYMmMvywvQZzyChu9MngH1DC93qtsw0aTEiLnzKPQlCeyaBsCEtV3r0h b2SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=gCvopVOfobmQuesAHChPgfYpOIfGb/WLFM1WRDKCe3s=; b=ggu8xL+tJrmH5cFL1ZNGDDAmgJe6GbQjS5o0aTpRURW0Z6eWftw1WMQVgrsiKDCiJa RrsONTXHKfMJN12Jh1z+cs/A2uI8E1GIIGXwfEpITXdq2qlYSa32NhVCmHQ0/AxiIN1u veZkluh2CAfuASYdDZoY9H1nld7JQdvXWXoorjWTFCxDRRsbRPxoZEDJHffPsOg3GL9S IMYbg09/R8TK/pjf727hiUVKaQnUgSyE8E8KYfWMSUdKbBXmfgTrfBKEtsix/7u9R7aN /ZnkuD+5ZA1N4TexP/9/jPD7WkiyMRhcV7dEj1D6IgfsPVkwzRkcGYQCVb7mXYgGVcDX g8hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=TQ+sGkca; 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 g18si10813055pgk.477.2019.06.17.01.52.05; Mon, 17 Jun 2019 01:52:20 -0700 (PDT) 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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=TQ+sGkca; 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 S1727947AbfFQIvZ (ORCPT + 99 others); Mon, 17 Jun 2019 04:51:25 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40258 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727932AbfFQIvY (ORCPT ); Mon, 17 Jun 2019 04:51:24 -0400 Received: by mail-pg1-f195.google.com with SMTP id w10so775219pgj.7 for ; Mon, 17 Jun 2019 01:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=gCvopVOfobmQuesAHChPgfYpOIfGb/WLFM1WRDKCe3s=; b=TQ+sGkcajXwECm/kdggg7cStsdl/xrIv8JRcqDarn1eaKV7HpTpxHzFzmPiIO2veOO NmpbhXs8RgDzXFSLCanM9x0sn56F6UQVYzSYsvB88xIbnF6xNaYVN35CkuTkAwv6n7pO xlu5R0Gek1L3rI1EDkXJ5jxpl6GjWfKyf5H2zX0f8p5/gIj388t9qbiQSldmzqNLir3S RFKt8jwMNaOq5RK1kXkiKeb7nbbttkg0NiAdQ9NiR+WRljT7VHaQ4pMslTPu4rawhAq0 b1flMfAfDPePnHunFaWJYDrf31uZBnto1a44HkHR4QonqpMRJ9gJK9c1y3yWNQDTPQfB jtHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=gCvopVOfobmQuesAHChPgfYpOIfGb/WLFM1WRDKCe3s=; b=jXXvWs01AWqyyp6SmayZen/AaanjMvaPFD7A9ysNw5O/mzJdKyJLIm+HktR3BTzvk7 Sg2iMsq6PxZ2/wB2shgov7U0dpXEg7eUntxjB4dkfWAYd9m2V7apxj9IJCVnAnLGx2Rb snTyAGZpe8Pcteje78Zw/Zpq9irOc7qSVEGGDz5hgWcr9z+uS0SmeD4/JzBFDp9EKcEE SiiDPtqJ3wYsKPPLihq138BCKX6JW3fbdvrqTa/5PZow6UqMLwalGL01EksQuSsuRZwE +TDrTGTxXU5P5xqGhu8Snve0Ik1p7W4J9U0H5d2ovuMQBf5dHFGndReWG2fkdbFpijoj Ie1w== X-Gm-Message-State: APjAAAXjd6k2wi5nmlG+oiGFd02mNqWMFwv4CQhRQZo/8SGf8mBZxL5e j/RTZb64mMWJcWqSoLUHjA== X-Received: by 2002:a17:90a:be0a:: with SMTP id a10mr23682369pjs.112.1560761484028; Mon, 17 Jun 2019 01:51:24 -0700 (PDT) Received: from www9186uo.sakura.ne.jp (www9186uo.sakura.ne.jp. [153.121.56.200]) by smtp.gmail.com with ESMTPSA id d4sm9443514pju.19.2019.06.17.01.51.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 01:51:23 -0700 (PDT) From: Naoya Horiguchi To: linux-mm@kvack.org Cc: Andrew Morton , Michal Hocko , Mike Kravetz , xishi.qiuxishi@alibaba-inc.com, "Chen, Jerry T" , "Zhuo, Qiuxu" , linux-kernel@vger.kernel.org, Anshuman Khandual Subject: [PATCH v3 1/2] mm: soft-offline: return -EBUSY if set_hwpoison_free_buddy_page() fails Date: Mon, 17 Jun 2019 17:51:15 +0900 Message-Id: <1560761476-4651-2-git-send-email-n-horiguchi@ah.jp.nec.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1560761476-4651-1-git-send-email-n-horiguchi@ah.jp.nec.com> References: <1560761476-4651-1-git-send-email-n-horiguchi@ah.jp.nec.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The pass/fail of soft offline should be judged by checking whether the raw error page was finally contained or not (i.e. the result of set_hwpoison_free_buddy_page()), but current code do not work like that. So this patch is suggesting to fix it. Without this fix, there are cases where madvise(MADV_SOFT_OFFLINE) may not offline the original page and will not return an error. It might lead us to misjudge the test result when set_hwpoison_free_buddy_page() actually fails. Signed-off-by: Naoya Horiguchi Fixes: 6bc9b56433b76 ("mm: fix race on soft-offlining") Cc: # v4.19+ --- ChangeLog v2->v3: - update patch description to clarify user visible change --- mm/memory-failure.c | 2 ++ 1 file changed, 2 insertions(+) diff --git v5.2-rc4/mm/memory-failure.c v5.2-rc4_patched/mm/memory-failure.c index 8da0334..8ee7b16 100644 --- v5.2-rc4/mm/memory-failure.c +++ v5.2-rc4_patched/mm/memory-failure.c @@ -1730,6 +1730,8 @@ static int soft_offline_huge_page(struct page *page, int flags) if (!ret) { if (set_hwpoison_free_buddy_page(page)) num_poisoned_pages_inc(); + else + ret = -EBUSY; } } return ret; -- 2.7.0