From patchwork Fri Nov 9 06:47:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 10675359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 57DD013BF for ; Fri, 9 Nov 2018 06:47:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4595C2DD3D for ; Fri, 9 Nov 2018 06:47:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3933E2DD51; Fri, 9 Nov 2018 06:47:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0B972DD3D for ; Fri, 9 Nov 2018 06:47:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 827AA6B0693; Fri, 9 Nov 2018 01:47:31 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7B0BA6B0694; Fri, 9 Nov 2018 01:47:31 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 69F6E6B0695; Fri, 9 Nov 2018 01:47:31 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by kanga.kvack.org (Postfix) with ESMTP id 1CB376B0693 for ; Fri, 9 Nov 2018 01:47:31 -0500 (EST) Received: by mail-pf1-f200.google.com with SMTP id n22-v6so787377pff.2 for ; Thu, 08 Nov 2018 22:47:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:sender:from:to:cc:subject:date :message-id; bh=gAKYnJ5psk2wV1xt10r7KXfjHnI7pT+UXbJjL44QN3U=; b=N4poJ47R11lpB7JIqbSqB1VDOW0XsluOrK6drjt53S6xeD6unHPSmdgBunBwfeljgB Unvpi16EQN6gA/x7Kl8vona+vrk9IPUkXr9jzxIYt9WPPx4gf79Saxhjnt3d/mtCj4SK FiDanHJ0sUM6ilVHRQ+NDOS/HOzq4qQ2G1iqKsACTzDH5TgHyOq9Y6vDIxC5AqmIk9XU sLA89++PpAOef/lb4gpGC4sfhEAoJZ8uQ+RL68EpIMIaFtmRtQBZxWKpGpRm+yc96ddw k/KqxV6iDIiAi+r/sfT/akMhGYO9cwhQT8u6fuKJKwz12vz5D8PaTymrSPvVHrod7gf/ OZ4g== X-Gm-Message-State: AGRZ1gLrvbq+Z4lW76QHkkXe5N+i1V5I9VN+8Xlt2RopKLYJfGNHMcTF k1j6dtgsaEJfQw8ETo65drbCR5A+y9sn54Kb4sueRY9mOcb9CpbUZS3vmJOj9fO8c6UKYPpFLuv txYIm1Feo2GVZhWw/+NOfshn4mZThkSuuWrTw33vPQq3qXBWO920fh3SCVloTgj5N7lxewJWGY+ AwJZm1ov9WBRgQVkmb595DA2sJlBROYGgqzgLn0iMUEhuVDLFJJPI3rAR2PDC/r8OdtjgnnvgYw z5W93monbPVXyifl3Du/SE0mSMC/rpzg9ae3vZFmGgNOwDwnpbM2tO6rPW4VDhZ+JpDkg//6PUQ +Nth0KsYXNTw8MdiWa/dinyteq5B4QsFwKVvKBie8pzgmr14jTAA9FPmZYXW0U277i1pT+VraQ= = X-Received: by 2002:a63:1321:: with SMTP id i33mr6616491pgl.380.1541746050605; Thu, 08 Nov 2018 22:47:30 -0800 (PST) X-Received: by 2002:a63:1321:: with SMTP id i33mr6616456pgl.380.1541746049499; Thu, 08 Nov 2018 22:47:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541746049; cv=none; d=google.com; s=arc-20160816; b=p2O/DReVtUsjY7qYkEDDYdYiKOS5W9Tk7eAq1S2Aa2XNlrxEj8GL/w2TH9mqGHb9XB n/dqfXnOq4xq0Y/beGLz8lkYUAsEdiOxwZ2ZUCLDiJRqg7T2cTzgoN6E0nM9zy3atHtX tow57VPId11fPK/+PcTO8eWO5bplEiIi/jBZZhu9gei7WJ+ihW5hfl6HuJIk+Gg5K4+F S1ncrmSLuW0zXw3xGPXyCtDWUcna/lpjuhiMamNUITWPFn6lJ6hw4VRYE3ky3aRg1Tax 5kvtar32NSTvN0xufgl2vvpc4eL3F8AAS12KL1RCvdK2s7dJmHKos4y6L3N+l7hpIj/b W7SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:sender:dkim-signature; bh=gAKYnJ5psk2wV1xt10r7KXfjHnI7pT+UXbJjL44QN3U=; b=Scxu8M0U6gu0T3K82B4zAt3wUvOF9Lu2cmshLX3PTz+QM2Sz4P4wUb6CrgNnrQYbu6 BhIU0lMd+tj648zNmtLFpMDKav41i0Z20D2raemEvNNtgMlI1UAj+9IKHLnOWIa+Q/cx y5bRSCoVLutDJGp2R2ChIU+oeRAwX7I95nLzxoE/Z0yoJAB5VowL+0JsyA/DA2KgEnPu QixDRg4VU7U7VDR5grySgftJlKTMn87weAC1VK08ksY0/6BhSrIA35oQrD0NpCemXE1k dG8dxVt2kRkq3R4s86WXdIstyb27Cn9Qs4rV7GhgRadbwQk5eSsay4A1p4sg0WagDEWy M/Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jYXR7vn3; spf=pass (google.com: domain of nao.horiguchi@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=nao.horiguchi@gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id s9-v6sor7159414pgs.2.2018.11.08.22.47.29 for (Google Transport Security); Thu, 08 Nov 2018 22:47:29 -0800 (PST) Received-SPF: pass (google.com: domain of nao.horiguchi@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jYXR7vn3; spf=pass (google.com: domain of nao.horiguchi@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=nao.horiguchi@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=gAKYnJ5psk2wV1xt10r7KXfjHnI7pT+UXbJjL44QN3U=; b=jYXR7vn3Nw/+VXdHhvGo/sLIJaHz2d523S2IeKjiFe6o3APPcw72YcmOMprs+73KJC 4Gun5Sz6ul+MLrEwzWP+1PpE/ZgqNXZL47pdkmtkndPeFvw9aKyGm7+TQ8nje2VVsfIZ rM9LNdxQmcUs7M/s/HGY0/3OFR2VDowKyod7jv1Ic8wjtnUXuD7RLfoOxKe8/8Mw4aHM iTRz+t6geXxbXuSc+iOFKJ2VSJuzh4Qzw5og1CkLnu4SY34ck5BpRjjO0TQ8s6iji5xo mBVJmlNuWGtCbqsWGixoecMazvMqlNZiHezthMrK6oNdip3miyjZDpPqxWzoDufX6XrE oZRA== X-Google-Smtp-Source: AJdET5dEMRCoZJ4IGqcb0i1Vvnh8N1tjjhVNt2VOnZzGlUCkMAwwWBmM2J30oCd3tXVEiSNYNkLS2w== X-Received: by 2002:a63:f960:: with SMTP id q32-v6mr6272013pgk.213.1541746048880; Thu, 08 Nov 2018 22:47:28 -0800 (PST) Received: from www9186uo.sakura.ne.jp (www9186uo.sakura.ne.jp. [153.121.56.200]) by smtp.gmail.com with ESMTPSA id c70-v6sm6808355pfg.97.2018.11.08.22.47.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 22:47:28 -0800 (PST) From: Naoya Horiguchi To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Michal Hocko , Andrew Morton , Mike Kravetz , xishi.qiuxishi@alibaba-inc.com, Laurent Dufour Subject: [PATCH RFC v1 00/11] hwpoison improvement part 1 Date: Fri, 9 Nov 2018 15:47:04 +0900 Message-Id: <1541746035-13408-1-git-send-email-n-horiguchi@ah.jp.nec.com> X-Mailer: git-send-email 2.7.0 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: X-Virus-Scanned: ClamAV using ClamSMTP Hi everyone, I wrote hwpoison patches which partially mention the problems discussed recently on this area [1]. Main point of this series is how we isolate faulty pages more safely/reliable. As pointed out from Michal in thread [2], we can have better isolation functions rather than what we currently have. Patch 8/11 gives the implementation. As a result, the behavior of poisoned pages (at least from soft-offline) are more predictable and I think that memory hotremove should properly work with it. The structure of this series: - patch 1-7 are small fixes, preparation, and/or cleanup. I can separate these out from main part if you like. - patch 8 is core part of this series, providing some code to pick out the target page from buddy allocator, - patch 9-11 are changes on caller sides (hard-offline, hotremove and unpoison.) One big issue not addressed by this series is hard-offlining hugetlb, which is still a todo unfortunately. Another remaining work is to rework on the behavior of PG_hwpoison flag from hard-offlining of in-use page. Even with this series, hard-offline for in-use pages works as in the past (i.e. we still take racy "set PG_hwpoison at first, then do some handling" approach.) Without changing this, we can't be free from many "if (PageHWPoison)" checks in mm code. So I'll think/try more about it after this one. Anyway this is the first step for better solution (I believe,) and any kind of help is applicated. Thanks, Naoya Horiguchi [1]: https://lwn.net/Articles/753261/ [2]: https://lkml.org/lkml/2018/7/17/60 --- Summary: Naoya Horiguchi (11): mm: hwpoison: cleanup unused PageHuge() check mm: soft-offline: add missing error check of set_hwpoison_free_buddy_page() mm: move definition of num_poisoned_pages_inc/dec to include/linux/mm.h mm: madvise: call soft_offline_page() without MF_COUNT_INCREASED mm: hwpoison-inject: don't pin for hwpoison_filter() mm: hwpoison: remove MF_COUNT_INCREASED mm: remove flag argument from soft offline functions mm: soft-offline: isolate error pages from buddy freelist mm: hwpoison: apply buddy page handling code to hard-offline mm: clear PageHWPoison in memory hotremove mm: hwpoison: introduce clear_hwpoison_free_buddy_page() drivers/base/memory.c | 2 +- include/linux/mm.h | 22 ++++++--- include/linux/page-flags.h | 8 +++- include/linux/swapops.h | 16 ------- mm/hwpoison-inject.c | 18 ++------ mm/madvise.c | 25 +++++----- mm/memory-failure.c | 112 ++++++++++++++++++++++++++------------------- mm/migrate.c | 9 ---- mm/page_alloc.c | 95 +++++++++++++++++++++++++++++++++++--- mm/sparse.c | 2 +- 10 files changed, 193 insertions(+), 116 deletions(-)