From patchwork Fri Jul 31 12:20:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 11694825 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B813A1392 for ; Fri, 31 Jul 2020 12:21:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8212C2087C for ; Fri, 31 Jul 2020 12:21:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LrT5598o" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8212C2087C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5D9C28D0023; Fri, 31 Jul 2020 08:21:22 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 56A708D000B; Fri, 31 Jul 2020 08:21:22 -0400 (EDT) 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 405208D0023; Fri, 31 Jul 2020 08:21:22 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by kanga.kvack.org (Postfix) with ESMTP id 262658D000B for ; Fri, 31 Jul 2020 08:21:22 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id AEE483626 for ; Fri, 31 Jul 2020 12:21:21 +0000 (UTC) X-FDA: 77098281162.25.birds48_580ac4926f83 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 7BF2B1804E3A9 for ; Fri, 31 Jul 2020 12:21:21 +0000 (UTC) X-Spam-Summary: 1,0,0,bce60a2050483fee,d41d8cd98f00b204,nao.horiguchi@gmail.com,,RULES_HIT:41:69:355:379:541:800:966:967:968:973:988:989:1260:1345:1437:1535:1543:1711:1730:1747:1777:1792:2196:2199:2393:2525:2559:2567:2570:2682:2685:2703:2859:2899:2909:2910:2933:2937:2939:2942:2945:2947:2951:2954:3022:3354:3865:3866:3867:3868:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4117:4250:4321:4362:4385:4605:5007:6119:6261:7514:7903:8660:8957:9010:9025:9391:9413:10004:11658:12740:13148:13161:13205:13229:13230,0,RBL:209.85.216.65:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.100;04y8oug1fyprsy45xnitw4r65yu7yycjpxpy4bxxaj97mbd5sp8nzkbktxxkncf.ew3zafygtq4zxmdfys11zw7itie6ecze4k96opnw8ejpn6uxhbyzitkt5mfu48e.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:35,LUA_SUMMARY:none X-HE-Tag: birds48_580ac4926f83 X-Filterd-Recvd-Size: 6149 Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Fri, 31 Jul 2020 12:21:20 +0000 (UTC) Received: by mail-pj1-f65.google.com with SMTP id c10so4057172pjn.1 for ; Fri, 31 Jul 2020 05:21:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=mttZ04kQ/v9J1QJybdv51iwj40ObGuI3MVmwqoDkiZ0=; b=LrT5598o9VMdu0X5XOlouFmr5Qw67qfstVfTrCPorImKB6M7XkgUavzYJF62lN+GG/ uIjlarspQ8mC2RBYPhUCzFbZhlLiodENrimruxiJfc2XlTYMKGqKfM5xf95pMKsPgkWc W73m733DRLqOnENC/+6ARXL4bzNsYq+TcysWzA/ZeLwr+kN9qdvw70oDkpBL6GlAC4hn v3zWize75e3phA/BlKc4knVPmmoF/LNHj1PhY2QNyZ/nA8mKHs+S9bjO5WvpRkKLMsaH ixw2oAUYWbKBCtxam0vxfWZ7m8Y+EVaMMQ6cLMl4nBW7OzQxL3gqmMbuGG7pmE4xdeyt hzUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=mttZ04kQ/v9J1QJybdv51iwj40ObGuI3MVmwqoDkiZ0=; b=IGLFHHEN4X5aLSuCEfUG2U19x9JMPvjkCbWcAN6/4O9Wv8fI6+VTb894cfdCc2iRBM C2xBzJcz/H+y/+HrNBaJBFU0e4sX96ZyzpJmsIL7XPIN6mQ15zH9/KLc/ufMPYpl24Oa ymlvbpY5On82KgTiAEMoVdcFMZ4J/RgiumfBSXE6H1XTN/c5CdYHDLt7ABaMQ+/WP9W8 gEEvF2FUGBLcN9GWykye+oW/D9LEh4t8zcK2cLreb28ail5Lbg+lid0VBVJ/WkBGpnyS dCO/H2jdnkC4iVlt5/ylZ6QoaQQf4aRdYy8lvssN5A2gsyjXbTS8+p2DbmOi9uzRsyoS GQ5A== X-Gm-Message-State: AOAM533TkQB8onAm1GtCJ91KX/NAeFMGurgfXPqJZunqDiSnOTMjmU8+ AEjwdo0zJE9Fd2SOORsfi4ysSuP2FA== X-Google-Smtp-Source: ABdhPJxTAedKVLPMS2eYF9B6N6kzCNJtA9resgP55mdS2aH4MGOecGSxPrGTvFmJGZBrM3W1fq8LXw== X-Received: by 2002:a63:1208:: with SMTP id h8mr3546268pgl.128.1596198077926; Fri, 31 Jul 2020 05:21:17 -0700 (PDT) Received: from ip-172-31-41-194.ap-northeast-1.compute.internal (ec2-52-199-21-241.ap-northeast-1.compute.amazonaws.com. [52.199.21.241]) by smtp.gmail.com with ESMTPSA id m19sm3675692pjv.34.2020.07.31.05.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2020 05:21:17 -0700 (PDT) From: nao.horiguchi@gmail.com To: linux-mm@kvack.org Cc: mhocko@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, osalvador@suse.de, tony.luck@intel.com, david@redhat.com, aneesh.kumar@linux.vnet.ibm.com, zeil@yandex-team.ru, cai@lca.pw, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org Subject: [PATCH v5 00/16] HWPOISON: soft offline rework Date: Fri, 31 Jul 2020 12:20:56 +0000 Message-Id: <20200731122112.11263-1-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.17.1 X-Rspamd-Queue-Id: 7BF2B1804E3A9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: This patchset is the latest version of soft offline rework patchset targetted for v5.9. Main focus of this series is to stabilize soft offline. Historically soft offlined pages have suffered from racy conditions because PageHWPoison is used to a little too aggressively, which (directly or indirectly) invades other mm code which cares little about hwpoison. This results in unexpected behavior or kernel panic, which is very far from soft offline's "do not disturb userspace or other kernel component" policy. Main point of this change set is to contain target page "via buddy allocator", where we first free the target page as we do for normal pages, and remove from buddy only when we confirm that it reaches free list. There is surely race window of page allocation, but that's fine because someone really want that page and the page is still working, so soft offline can happily give up. v4 from Oscar tries to handle the race around reallocation, but that part seems still work in progress, so I decide to separate it for changes into v5.9. Thank you for your contribution, Oscar. The issue reported by Qian Cai is fixed by patch 16/16. This patchset is based on v5.8-rc7-mmotm-2020-07-27-18-18, but I applied this series after reverting previous version. Maybe https://github.com/Naoya-Horiguchi/linux/commits/soft-offline-rework.v5 shows what I did more precisely. Any other comment/suggestion/help would be appreciated. Thanks, Naoya Horiguchi Signed-off-by: Oscar Salvador Signed-off-by: Naoya Horiguchi --- Previous versions: v1: https://lore.kernel.org/linux-mm/1541746035-13408-1-git-send-email-n-horiguchi@ah.jp.nec.com/ v2: https://lore.kernel.org/linux-mm/20191017142123.24245-1-osalvador@suse.de/ v3: https://lore.kernel.org/linux-mm/20200624150137.7052-1-nao.horiguchi@gmail.com/ v4: https://lore.kernel.org/linux-mm/20200716123810.25292-1-osalvador@suse.de/ --- Summary: Naoya Horiguchi (8): mm,hwpoison: cleanup unused PageHuge() check mm, hwpoison: remove recalculating hpage 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,hwpoison: remove flag argument from soft offline functions mm,hwpoison: introduce MF_MSG_UNSPLIT_THP mm,hwpoison: double-check page count in __get_any_page() Oscar Salvador (8): mm,madvise: Refactor madvise_inject_error mm,hwpoison: Un-export get_hwpoison_page and make it static mm,hwpoison: Kill put_hwpoison_page mm,hwpoison: Unify THP handling for hard and soft offline mm,hwpoison: Rework soft offline for free pages mm,hwpoison: Rework soft offline for in-use pages mm,hwpoison: Refactor soft_offline_huge_page and __soft_offline_page mm,hwpoison: Return 0 if the page is already poisoned in soft-offline drivers/base/memory.c | 2 +- include/linux/mm.h | 12 +- include/linux/page-flags.h | 6 +- include/ras/ras_event.h | 3 + mm/hwpoison-inject.c | 18 +-- mm/madvise.c | 39 +++--- mm/memory-failure.c | 334 ++++++++++++++++++++------------------------- mm/migrate.c | 11 +- mm/page_alloc.c | 60 ++++++-- 9 files changed, 233 insertions(+), 252 deletions(-)