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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D642C43461 for ; Wed, 16 Sep 2020 19:31:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8681820770 for ; Wed, 16 Sep 2020 19:31:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="i/4kg5V3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8681820770 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EC38D90000F; Wed, 16 Sep 2020 15:31:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E7394900007; Wed, 16 Sep 2020 15:31:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D897890000F; Wed, 16 Sep 2020 15:31:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0024.hostedemail.com [216.40.44.24]) by kanga.kvack.org (Postfix) with ESMTP id ADDC7900007 for ; Wed, 16 Sep 2020 15:31:30 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 650F7180AD804 for ; Wed, 16 Sep 2020 19:31:30 +0000 (UTC) X-FDA: 77269918740.14.bells53_36157a22711c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id 3752518229837 for ; Wed, 16 Sep 2020 19:31:30 +0000 (UTC) X-HE-Tag: bells53_36157a22711c X-Filterd-Recvd-Size: 7205 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Wed, 16 Sep 2020 19:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600284689; 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=kMsSlQUnIzmWDNnPzcTOyEQmBqnfWVBVNUaHl4+/lPY=; b=i/4kg5V3H11zCN3p9/pN+9XJeRuyAabrfIB0bX7skS6c3JEWTINxCXTspktq5/oVwwvy70 sio1OD3wYr0MfR36UmCYj1+ntOvme9PBiwQ2IJ7Epx4qcHpTiRHQeNdyGQ/9CtOB8v4krW pAArM0LH65HWDl/3LVnCyShFD/ZLESw= 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-260-5qYx1cMBO2CdqIyPeZ1KtQ-1; Wed, 16 Sep 2020 15:31:25 -0400 X-MC-Unique: 5qYx1cMBO2CdqIyPeZ1KtQ-1 Received: by mail-ej1-f71.google.com with SMTP id e13so3383315ejk.1 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=toWQ8bfHT9cRNHIlNPdSHdytfKtR4O6eFWWwgfosyqoznkPq9rxdOZBvmWq7ujw6mN 41Noi4ldnyb/Ys/e5NybIhEHA0vGwboISW0L5A9dP2aclF5Jlo/uG13Gvo/+pxpRv0jE 3urlwCju4yOj+MGhzPNMRaRXiFeoXxrY8TQauknBCe8mMzUy3aAdKXo/l9dYlgp8wvAr WlVj7rrVraBzO/OppkVHA+CPQxdsiKgW6DtZnpNyXH1uxPO3zmQRbhT9qbWGKeIt6Jjo vGEb/9IkAaejkH6Wvnno6q+PGdzMblf2bzdlUrWcq/9jD7c07X6xTm+ovoOFQ+hf+Wt4 BFEQ== X-Gm-Message-State: AOAM530hTPW29y+J0YlrcugPXZMIMPwCpeAzAYSu17iftO4lgwhk7+rC GyuHq+gJO0wpbzApxwczzIHZLt193LVyjYbs2E1/aU7RZQKkobE9T5mp4/X4Q2jX8ZWlC4Yd1JJ XAdHPJ0yflxg= X-Received: by 2002:aa7:c7c2:: with SMTP id o2mr30417834eds.366.1600284684124; Wed, 16 Sep 2020 12:31:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNf5C6IgWA4C90hz+1DV+boU+avbJN14GYmBM3jetRxVAOiNjdDaQK6JfCvz8qKCYsfBo/YA== 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) 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) Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0.502 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 3752518229837 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: > 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= be >> 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 unmovabl= e >> 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: whe= n >> 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) whe= re >> 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 nons= ense, 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 d= ependencies due to the memmap. However, it=E2=80=98s not completely ideal, = especially for single memory blocks. With single memory blocks (virtio-mem, xen-balloon, hv balloon, ppc dlpar) = you still have unmovable (vmemmap chunks) all over the physical address spa= ce. Consider the gigantic page example after hotplug. You directly fragment= ed all hotplugged memory. Of course, there might be (less extreme) dependencies due page tables for t= he identity mapping, extended struct pages and similar. Having that said, there are other benefits when preferring other memory ove= r just hotplugged memory. Think about adding+onlining memory during boot (d= imms under QEMU, virtio-mem), once the system is up you will have most (all= ) of that memory completely untouched. So while vmemmap on hotplugged memory would tackle some part of the issue, = there are cases where this approach is better, and there are even benefits = when combining both. Thanks! David >=20 > I was about to give it a new respin now that thw hwpoison stuff has been = settled. >=20 > [1] https://patchwork.kernel.org/cover/11059175/ >=20