Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4421913pxa; Mon, 10 Aug 2020 08:42:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkWSBg7q5hhBsRuGEddcBOEDjCgBN4m+jpoYf5J6ra7SC/2MSGC0Kwb21Mad+W87dZ1b9V X-Received: by 2002:a17:906:5812:: with SMTP id m18mr22438185ejq.66.1597074153593; Mon, 10 Aug 2020 08:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597074153; cv=none; d=google.com; s=arc-20160816; b=TRh9hyLVCbRDuCQh1zoyYSoUMzgcStEbdK/cJMBkv783vYpYsGIXOHgBxpns+2ZTWP VoHmLhYVrdhQBCfZz/EVHSwv9u3TXlKU1BBbuMQ7HA3yLU0EJF20tMk3uJeF9cEOG9as +TjsK1nBah4rP1tjJlU5KCePtZZ5KykeUqZSQ7JSQtQqWzCZm9mQ6ULunQNgFhnfyDzd vN/3dl0W198kyI/USwu73B+BwJwq/0Ta9aG1fIgc4kj0aj+hiJZfUnup2mh+g1NIM4jp mc8BxqfoaEGlw7tLITXvfnUZMnTnYPoUnYOkE3e0o7n6npB5819wbM2Ieoiu76+VN9jN ZI1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=srW8JC4OGMffK9uy0eYrT8jtz9Osn+rCW418a4Q3BXw=; b=lP7tgJ4npA1qraAc/YL3haSMn8b8yqUPPhjyX/lZcJ7QmAW571K2fkAJ4nh49izA1v 9s0uBURS4S3wICwbvhJjTvKdRCqZGoLDlbc1mjpbInrZUlHn9eTIlgSapO8d9DQRDZNQ MRxywXiUTdt4go1aArNFkFezoEKCyBHETwDUAmBzi6s7T5e/09/7N1B7iLpS7lYNKxhk QMpUYIYzpJyTZ3puw7stpJ2FZh+d1C8P7dXcw0PuKzXdEpfdqD8gnek6F5uyqikz08dd 4sKlsS/hwSN8WEgYCyhD6fn7vUif/+A5NVQh+NJ3FoYaMWLH0SDMHtU25epjm9ykqE+r nonQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b="Cp9vxR/L"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u18si10896812ejr.600.2020.08.10.08.42.10; Mon, 10 Aug 2020 08:42:33 -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; dkim=pass header.i=@lca.pw header.s=google header.b="Cp9vxR/L"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728259AbgHJPXC (ORCPT + 99 others); Mon, 10 Aug 2020 11:23:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728270AbgHJPW7 (ORCPT ); Mon, 10 Aug 2020 11:22:59 -0400 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56719C061756 for ; Mon, 10 Aug 2020 08:22:59 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id o22so6982166qtt.13 for ; Mon, 10 Aug 2020 08:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=srW8JC4OGMffK9uy0eYrT8jtz9Osn+rCW418a4Q3BXw=; b=Cp9vxR/L94JlasdStrT2WqaBv+NMta2KiGO/xF5jxESwWDMM2WIVIiuZNB/8ZmMt8s abAply+auG+EFLF55gjNORKv4HMfgBCcavovvBd3PdtLna5CpBJBty0Tuh7okwnqWaU+ Y/+KpUQ3ymS/WV4IHiOoI3aIEhcGrawtw7HywSkw5JVmmHhiTgdU5HAhJPsJvAxjyHzt 2Gw6Wn3JhLjZOO3pYYy63Dsu5iGf0dc3cOUgIjDSTTfqkTX+EG6yWMZr1pFzOMUUOzEx 25j0PyEgFvkp7cVoXvdv1X5y34fDqYDegSERjc1F8F+cNWEMzBe4KAed3bGx/5R8jaMt STEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=srW8JC4OGMffK9uy0eYrT8jtz9Osn+rCW418a4Q3BXw=; b=Ch3IYbtXJJrQ6/UY0vuG6jWsXvOsX+r+JzSmzcPfzMGQQ4K1l60eBV8Iqt3OfFI5d0 MYEFTbMHY+l5Ol3YiAS8s1TcEvF56vnJdWIZBOWqHVS0376mzO0+lX/q5/bD31r/bFA0 oWZWOpz64YwTuYkZYlGqSvnVmdtaqrtaHaMGLm2ECmy7NzE3MF5GRHSLbJ/GeaNbG4C5 7SsFj9CqR1q86UjYRewl6XuP3571qSQd6pHEgnl2ulOdzVO0mcLi1TwMUyEMSjnAVqYJ pOnsCeymE6EybMAV25o2f6qRJ/2CINZl91/qXUqkUXVEdiZQKYaVv9jpBQQgsjWsqpjz Vjiw== X-Gm-Message-State: AOAM531K72wik2ARB6xmpb3HVuNb2dTMwgI7JswDTg2MqtRmAAkTYXUW jpus4dVsqKEXRJcSC3SzQJy7rQ== X-Received: by 2002:ac8:1729:: with SMTP id w38mr27932185qtj.103.1597072978450; Mon, 10 Aug 2020 08:22:58 -0700 (PDT) Received: from lca.pw (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id o15sm13738608qkk.95.2020.08.10.08.22.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2020 08:22:57 -0700 (PDT) Date: Mon, 10 Aug 2020 11:22:55 -0400 From: Qian Cai To: nao.horiguchi@gmail.com Cc: linux-mm@kvack.org, 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, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org Subject: Re: [PATCH v6 00/12] HWPOISON: soft offline rework Message-ID: <20200810152254.GC5307@lca.pw> References: <20200806184923.7007-1-nao.horiguchi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200806184923.7007-1-nao.horiguchi@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 06, 2020 at 06:49:11PM +0000, nao.horiguchi@gmail.com wrote: > Hi, > > This patchset is the latest version of soft offline rework patchset > targetted for v5.9. > > Since v5, I dropped some patches which tweak refcount handling in > madvise_inject_error() to avoid the "unknown refcount page" error. > I don't confirm the fix (that didn't reproduce with v5 in my environment), > but this change surely call soft_offline_page() after holding refcount, > so the error should not happen any more. With this patchset, arm64 is still suffering from premature 512M-size hugepages allocation failures. # git clone https://gitlab.com/cailca/linux-mm # cd linux-mm; make # ./random 1 - start: migrate_huge_offline - use NUMA nodes 0,1. - mmap and free 2147483648 bytes hugepages on node 0 - mmap and free 2147483648 bytes hugepages on node 1 madvise: Cannot allocate memory [ 292.456538][ T3685] soft offline: 0x8a000: hugepage isolation failed: 0, page count 2, type 7ffff80001000e (referenced|uptodate|dirty|head) [ 292.469113][ T3685] Soft offlining pfn 0x8c000 at process virtual address 0xffff60000000 [ 292.983855][ T3685] Soft offlining pfn 0x88000 at process virtual address 0xffff40000000 [ 293.271369][ T3685] Soft offlining pfn 0x8a000 at process virtual address 0xffff60000000 [ 293.834030][ T3685] Soft offlining pfn 0xa000 at process virtual address 0xffff40000000 [ 293.851378][ T3685] soft offline: 0xa000: hugepage migration failed -12, type 7ffff80001000e (referenced|uptodate|dirty|head) The fresh-booted system still had 40G+ memory free before running the test. Reverting the following commits allowed the test to run succesfully over and over again. "mm, hwpoison: remove recalculating hpage" "mm,hwpoison-inject: don't pin for hwpoison_filter" "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" i.e., it is not enough to only revert, mm,hwpoison: double-check page count in __get_any_page() mm,hwpoison: introduce MF_MSG_UNSPLIT_THP mm,hwpoison: return 0 if the page is already poisoned in soft-offline > > Dropped patches > - mm,madvise: call soft_offline_page() without MF_COUNT_INCREASED > - mm,madvise: Refactor madvise_inject_error > - mm,hwpoison: remove MF_COUNT_INCREASED > - mm,hwpoison: remove flag argument from soft offline functions > > Thanks, > Naoya Horiguchi > > Quoting cover letter of v5: > ---- > 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. > > --- > 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/ > v5: https://lore.kernel.org/linux-mm/20200805204354.GA16406@hori.linux.bs1.fc.nec.co.jp/T/#t > --- > Summary: > > Naoya Horiguchi (5): > mm,hwpoison: cleanup unused PageHuge() check > mm, hwpoison: remove recalculating hpage > mm,hwpoison-inject: don't pin for hwpoison_filter > mm,hwpoison: introduce MF_MSG_UNSPLIT_THP > mm,hwpoison: double-check page count in __get_any_page() > > Oscar Salvador (7): > 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 > > include/linux/mm.h | 3 +- > include/linux/page-flags.h | 6 +- > include/ras/ras_event.h | 3 + > mm/hwpoison-inject.c | 18 +-- > mm/madvise.c | 5 - > mm/memory-failure.c | 307 +++++++++++++++++++++------------------------ > mm/migrate.c | 11 +- > mm/page_alloc.c | 60 +++++++-- > 8 files changed, 203 insertions(+), 210 deletions(-)