Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp627945pxk; Wed, 16 Sep 2020 12:40:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyH0yPbkM/e0HL+PwuRcxOeDOD0rbc0Inm70QGaw8TeWhzUMcEomCWwReRWkdZLe6CkeCCQ X-Received: by 2002:aa7:d35a:: with SMTP id m26mr28334275edr.183.1600285213372; Wed, 16 Sep 2020 12:40:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600285213; cv=none; d=google.com; s=arc-20160816; b=mAjD1NHNcHhQpA7Bj7PuiFAW6C2lR/5eIYqcvVO0a39jfDDgT6F3esIp3zAoWCwHuZ dpHbcQ2Cu6IeW4M/9nzY3JeUO7JLYaJZcPbZzWOt/o9iVGi2/K1wnLigAsp1z4AIRp05 1zqkmmJkSsG2Jrl3w9AjlNZtXXCOQIThLQTByTMJ+4XGZQKL9wbULi8kisKW4d2OCijo 2k0nibqp8nSPnxAdicfOao2NZ+F7sbjYJlmHlltig7ppEnkAAxUHUD+RvFcRu6okuQci 5QPm187DTn5U2KRWGIzJ6WOeK5uLulZsljH8R04u4k+1S1ez4uX/e+AxUFwJhnDkK8fY Nsog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=H30dbXoNbzsTkPGiKpd2XjhJWXqjtA7dGp0dwpbyBQA=; b=XgTqDX+7NUpxYQ70B92It5etxP4BWhAyBsjFD9xBuA0boyd7m/CTWHAMcJ4tvyw7LO 1ZxjMFbLW6PTHRBYlBHubf07bz2ERgUENZw8maarv5XPZQP0K5gszsANpRxjTHGw0SOy sqGYmZPEPO0qWt6J3LybXenYN1NmrN7BB1OGXCcz+clBxO1dc3NENebGA8gzyWWbH1Hn f08tzYZIEO18Y82pGRfMrzjwF5lTFf0uu0spHO5pFH+e299Orx/UGCZjIDoWmg5hNy5F hw0/EnNWPbuyyMCDPqh/Gf620PW/k0V5kXtfeQFSwYbCajfCGPif3ElKz/Sn23jBj3DE Ft8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q2TAjVK1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b23si12249797eje.20.2020.09.16.12.39.49; Wed, 16 Sep 2020 12:40:13 -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=@redhat.com header.s=mimecast20190719 header.b=Q2TAjVK1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727276AbgIPTeL (ORCPT + 99 others); Wed, 16 Sep 2020 15:34:11 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:25406 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727525AbgIPTcF (ORCPT ); Wed, 16 Sep 2020 15:32:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600284687; 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=H30dbXoNbzsTkPGiKpd2XjhJWXqjtA7dGp0dwpbyBQA=; b=Q2TAjVK1i1o+4f4DqEWRYey6mLyFuPShulyNtZBkiUUbfOiZk63wvoOdeg11Iya2uQTrWc d01hMvqoYOv8UiSuqQeR1EMd2EGC/9x1ZmySJymGhJ8fRmlWrWPmyRS3doUjSsdUFU1xAr DSMxEW/wKHFSRjEQ7WSm//CKRM/zYSo= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-20-IfqPHs6xOMydqlJLmFK5pA-1; Wed, 16 Sep 2020 15:31:25 -0400 X-MC-Unique: IfqPHs6xOMydqlJLmFK5pA-1 Received: by mail-ej1-f71.google.com with SMTP id w10so3340103ejq.11 for ; Wed, 16 Sep 2020 12:31:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=H30dbXoNbzsTkPGiKpd2XjhJWXqjtA7dGp0dwpbyBQA=; b=tmKZBWzvbb+8HjUSykl2NTU3iVbdt4j8hATziCqN0ASAgEulSldBhJbP/GhtuWIUcd 5rcSqdGGqAEqNWN3rI+WgFydRbVUjn3gogDCdfeWF6mbvXWQU2xTf6gIatLj6RkBQC9r 01EN9mpVLROCnBua9ZUDuC2A14bAX3jxxYYG8H08snHbyz9XiumssEV4tK6ThEIJOj0X 1nUfpRKE7TpTgRl8W8yDJYTq0BxemuDlF/q9NK2L3Iz0x4JkaPJqKmbiTJWlyQ9Zv8FU Adi74Rmo1LO9UJyD8QMU9zhZ40CCcshjWcV1vE58Exq740PPNXszy+OEb2jRPD9q8pLg SsOA== X-Gm-Message-State: AOAM5322sJBXclRJbagJfWx6F4Oh4MBDRTNBUq2Ip0pK/oq0iTV6QW0L XDPuxKRIt9gLYvwTUbmPedjutUP2q4gK90RQHudtM8fd8An0sjPt4b09PmIt/3VPC38UysL0WAY 1vzYbGfcNpXtpwYJeb+JdtH8T X-Received: by 2002:aa7:c7c2:: with SMTP id o2mr30417824eds.366.1600284684121; Wed, 16 Sep 2020 12:31:24 -0700 (PDT) X-Received: by 2002:aa7:c7c2:: with SMTP id o2mr30417797eds.366.1600284683833; Wed, 16 Sep 2020 12:31:23 -0700 (PDT) Received: from [192.168.3.122] (p4ff23c30.dip0.t-ipconnect.de. [79.242.60.48]) by smtp.gmail.com with ESMTPSA id k25sm13202917ejk.3.2020.09.16.12.31.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Sep 2020 12:31:23 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: David Hildenbrand Mime-Version: 1.0 (1.0) Subject: Re: [PATCH RFC 0/4] mm: place pages to the freelist tail when onling and undoing isolation Date: Wed, 16 Sep 2020 21:31:21 +0200 Message-Id: References: <5c0910c2cd0d9d351e509392a45552fb@suse.de> Cc: David Hildenbrand , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-hyperv@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, Andrew Morton , Alexander Duyck , Dave Hansen , Haiyang Zhang , "K. Y. Srinivasan" , Mel Gorman , Michael Ellerman , Michal Hocko , Mike Rapoport , Scott Cheloha , Stephen Hemminger , Vlastimil Babka , Wei Liu , Wei Yang In-Reply-To: <5c0910c2cd0d9d351e509392a45552fb@suse.de> To: osalvador@suse.de X-Mailer: iPhone Mail (17H35) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Am 16.09.2020 um 20:50 schrieb osalvador@suse.de: >=20 > =EF=BB=BFOn 2020-09-16 20:34, David Hildenbrand wrote: >> When adding separate memory blocks via add_memory*() and onlining them >> immediately, the metadata (especially the memmap) of the next block will b= e >> placed onto one of the just added+onlined block. This creates a chain >> of unmovable allocations: If the last memory block cannot get >> offlined+removed() so will all dependant ones. We directly have unmovable= >> allocations all over the place. >> This can be observed quite easily using virtio-mem, however, it can also >> be observed when using DIMMs. The freshly onlined pages will usually be >> placed to the head of the freelists, meaning they will be allocated next,= >> turning the just-added memory usually immediately un-removable. The >> fresh pages are cold, prefering to allocate others (that might be hot) >> also feels to be the natural thing to do. >> It also applies to the hyper-v balloon xen-balloon, and ppc64 dlpar: when= >> adding separate, successive memory blocks, each memory block will have >> unmovable allocations on them - for example gigantic pages will fail to >> allocate. >> While the ZONE_NORMAL doesn't provide any guarantees that memory can get >> offlined+removed again (any kind of fragmentation with unmovable >> allocations is possible), there are many scenarios (hotplugging a lot of >> memory, running workload, hotunplug some memory/as much as possible) wher= e >> we can offline+remove quite a lot with this patchset. >=20 > Hi David, >=20 Hi Oscar. > I did not read through the patchset yet, so sorry if the question is nonse= nse, but is this not trying to fix the same issue the vmemmap patches did? [= 1] Not nonesense at all. It only helps to some degree, though. It solves the de= pendencies due to the memmap. However, it=E2=80=98s not completely ideal, es= pecially for single memory blocks. With single memory blocks (virtio-mem, xen-balloon, hv balloon, ppc dlpar) y= ou still have unmovable (vmemmap chunks) all over the physical address space= . Consider the gigantic page example after hotplug. You directly fragmented a= ll hotplugged memory. Of course, there might be (less extreme) dependencies due page tables for th= e identity mapping, extended struct pages and similar. Having that said, there are other benefits when preferring other memory over= just hotplugged memory. Think about adding+onlining memory during boot (dim= ms under QEMU, virtio-mem), once the system is up you will have most (all) o= f that memory completely untouched. So while vmemmap on hotplugged memory would tackle some part of the issue, t= here are cases where this approach is better, and there are even benefits wh= en combining both. Thanks! David >=20 > I was about to give it a new respin now that thw hwpoison stuff has been s= ettled. >=20 > [1] https://patchwork.kernel.org/cover/11059175/ >=20