From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B63FDC433EF for ; Fri, 5 Nov 2021 13:03:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4FDCC60FE3 for ; Fri, 5 Nov 2021 13:03:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4FDCC60FE3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id BE5216B006C; Fri, 5 Nov 2021 09:03:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B94CC6B0071; Fri, 5 Nov 2021 09:03:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5CB1940007; Fri, 5 Nov 2021 09:03:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0156.hostedemail.com [216.40.44.156]) by kanga.kvack.org (Postfix) with ESMTP id 978576B006C for ; Fri, 5 Nov 2021 09:03:02 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4A8958249980 for ; Fri, 5 Nov 2021 13:03:02 +0000 (UTC) X-FDA: 78774891804.25.C13B36F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf10.hostedemail.com (Postfix) with ESMTP id CEF2A60019A7 for ; Fri, 5 Nov 2021 13:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636117379; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iLgQ5EmaL+DmQgkfnA8r6Au7OZ5a7gYy6SmBrNd2Jg0=; b=D06Erm+rJeWTrKtJoyiJ8OZPQh69QfZgm1SvwycTzB9mVMvv/03FEk+FNSwG4wG9FoF67T Ms598RF3smS4tw/Z+oTkKbAfTnVv+P3ZUftvbLcRvF2HqyPl67sryUExyvtXk8+C6EXwqd Zr6uUfouAHome6X2islfoFwxma57xzo= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-428-axFJ-NCtPXC-5cg67oAafA-1; Fri, 05 Nov 2021 09:02:58 -0400 X-MC-Unique: axFJ-NCtPXC-5cg67oAafA-1 Received: by mail-wm1-f71.google.com with SMTP id l187-20020a1c25c4000000b0030da46b76daso5644784wml.9 for ; Fri, 05 Nov 2021 06:02:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=iLgQ5EmaL+DmQgkfnA8r6Au7OZ5a7gYy6SmBrNd2Jg0=; b=5FEpuav0BZx6kD0LfoyNjkw4H6gkPAVXVdlnGzm++XS/47z5gukZlxTmv6F6EaMLMF kiEGsY00Lw9JKFQOG7sDSUBydqVHfsj/uhKqpFUdWewvzOOvDDxhgUuUby92LHtHWRun 7fIoV2Q1ZOETlpqEiIjxGcvw9TZ47TFDhtJHHTG6ptKnIoXi9RjnO2OPH+KJYWJWFU2X 4sNvrHyvRtHlq7pvER8ohCmB1nNx1H6YXuNhXx0t4gCysSSUKlNI8fkwJ8KKzDpgS276 szFz2qSQxxHgwWIzaS0shOS7Q7qUOmS1Dx0ldglO0Tj86IPl4VkYhlol5fCPDT/1Re8E eOZg== X-Gm-Message-State: AOAM533GFgm8uU1essl6bhE5qB0DzJBvT1bVQUFM0lBjtk4RPAX7Ydfq 7C2rH5DAOlAz2vNhEje1itt6C/ElWbnvbb0ThuLfPpjSbIZ512+ymhMXlG2hdC0kN3RFXT/Z1OG NRBnshQ1wZhM= X-Received: by 2002:adf:d1c2:: with SMTP id b2mr8894833wrd.369.1636117377172; Fri, 05 Nov 2021 06:02:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4FNkl2pJ0RVTR1lono1DFLFCRUFCJzXmJtOSdgDG0W+NMxHGOW8KGvf14VSf7b8sSj83Bvw== X-Received: by 2002:adf:d1c2:: with SMTP id b2mr8894791wrd.369.1636117376914; Fri, 05 Nov 2021 06:02:56 -0700 (PDT) Received: from ?IPV6:2003:d8:2f0c:a000:3f25:9662:b5cf:73f9? (p200300d82f0ca0003f259662b5cf73f9.dip0.t-ipconnect.de. [2003:d8:2f0c:a000:3f25:9662:b5cf:73f9]) by smtp.gmail.com with ESMTPSA id o1sm8061186wru.91.2021.11.05.06.02.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Nov 2021 06:02:56 -0700 (PDT) Message-ID: <3b675cb9-3002-b1a7-1b24-fdd38b55d73b@redhat.com> Date: Fri, 5 Nov 2021 14:02:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 To: Naoya Horiguchi Cc: Naoya Horiguchi , linux-mm@kvack.org, Andrew Morton , Oscar Salvador , Michal Hocko , Ding Hui , Tony Luck , "Aneesh Kumar K.V" , Miaohe Lin , Yang Shi , Peter Xu , linux-kernel@vger.kernel.org References: <20211105114954.GA3163106@u2004> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v3 0/3] mm/hwpoison: fix unpoison_memory() In-Reply-To: <20211105114954.GA3163106@u2004> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: CEF2A60019A7 X-Stat-Signature: 4z9xth9rep4efbxayz87tgo15trqusk7 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=D06Erm+r; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf10.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-HE-Tag: 1636117368-224631 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: On 05.11.21 12:49, Naoya Horiguchi wrote: > On Fri, Nov 05, 2021 at 11:58:15AM +0100, David Hildenbrand wrote: >> On 05.11.21 06:50, Naoya Horiguchi wrote: >>> Hi, >>> >>> I updated the unpoison patchset based ou discussions over v2. >>> Please see individual patches for details of updates. >>> >>> ----- (cover letter copied from v2) ----- >>> Main purpose of this series is to sync unpoison code to recent changes >>> around how hwpoison code takes page refcount. Unpoison should work or >>> simply fail (without crash) if impossible. >>> >>> The recent works of keeping hwpoison pages in shmem pagecache introduce >>> a new state of hwpoisoned pages, but unpoison for such pages is not >>> supported yet with this series. >>> >>> It seems that soft-offline and unpoison can be used as general purpose >>> page offline/online mechanism (not in the context of memory error). >> >> I'm not sure what the target use case would be TBH ... for proper memory >> offlining/memory hotunplug we have to offline whole memory blocks. For >> memory ballooning based mechanisms we simply allocate random free pages >> and eventually trigger reclaim to make more random free pages available. >> For memory hotunplug via virtio-mem we're using alloc_contig_range() to >> allocate ranges of interest we logically unplug. > > I heard about it from two people independently and I think that that's maybe > a rough idea, so if no one shows the clear use case or someone logically > shows that we don't need it, I do not head for it. I'd love to learn about use cases! > >> >> The only benefit compared to alloc_contig_range() might be that we can >> offline smaller chunks -- alloc_contig_range() isn't optimized for >> sub-MAX_ORDER granularity yet. But then, alloc_contig_range() should >> much rather be extended. > > If alloc_contig_range() supports memory offline in arbitrary size of > granurality (including a single page), maybe soft offline can be (partially > I guess) unified to it. Conceptually, memory offlining, alloc_contig_range(), soft-offlining all perform roughly the same thing just with different flavors: evacuate a given PFN area and decide what shall happen with it. After memory offlining, memory cannot get reused (e.g., allocated via the buddy) before re-onlining that memory. It's some kind of "fake allocation" + advanced magic to actually remove the memory from the system. alloc_contig_range() is just a "real" allocation, and can be used (e.g., by virtio-mem) for fake offlining by some additional magic on top. soft-offlining is just another special type of "special allocation", however, focused on individual page. The biggest difference between soft-offlining and alloc_contig_range()+memory offlining is right now the granularity. While alloc_contig_range() can be used to allocate individual pages on ZONE_MOVABLE and MIGRATE_CMA, it cannot deal with other zones with such small granularity yet -- too many false negatives, meaning an allocation might fail although the single page actually could get allocated. -- Thanks, David / dhildenb