Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6499450pxb; Wed, 17 Feb 2021 06:17:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+ed9c00gtz8y//SzLAsf08+ZdrkmWa72mVQ4FG7VmxXETdc0JhYoifVa/qLwidZ8KX7ML X-Received: by 2002:a05:6402:1148:: with SMTP id g8mr26148063edw.339.1613571453433; Wed, 17 Feb 2021 06:17:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613571453; cv=none; d=google.com; s=arc-20160816; b=cAZk0kjN67pHpMDdSpf5YMDHRrZgtggEMfWOXs8pMMAYhpsCQa3zgEMhijUvFETIjQ 020kK3rz/EPGbzRbmt4uE7PO/eFZ4t8C+ou03sSpG6Pxx2zT2g1yXoZ4/RuGJYZAutYw 6iYnG4nL16Yjn2C8ioHrSbZxku/PPfSIgGpn37sCkfo3PprYsSj8NFYzJOLmErQZrvh5 qV0CxNufO+8BnyhOuaFe3PJq9sL/iz2D4KwUy7Mscu0TxMlq3ijKAi1pttvks1N2SPkQ Hp+mrTrjwLdg4t1UI6SUzor1z/iFl2yPahVFeTbP4lnTA3V7idJAI2Huw+43W/mDoxlZ jSWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zrNRTe46UspWVm0C7Y/cZDBRLIXFQ95FjJ33Q06xdsM=; b=iMUudH7BCd0B3Lok8s21C2poBsGuCo6FFTi+fbSdTvvga0Ov4ziNv2WgYdW6CiNW3f 8GbNfYXsTYjQGyNs1U9pjy84gaPZ45aAnI+HSgIW83X0MR5Z1RlkMXXML1QeIVMRCmUT NPPK4IKxNLfQXIKAvcD/JonZEXwFk50+M6FPvPtG4Iv3IfjPY9pR85VOa6xH5sE8fGyi nTrjEdNBjGHiJYfizFUUH72XkC/D43O6JVmmONGrTM5js/DbGUJQt37xBfsvSyYyAvXC 3Aa+cWpleYsUANmYHVhVDkZUU7cBt7zMj3bx16MufWmdQD9gmxbVuAdVVSB6Dq2BaqLw UWdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=cP25jOTU; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q12si1570321ejs.148.2021.02.17.06.17.09; Wed, 17 Feb 2021 06:17:33 -0800 (PST) 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=@suse.com header.s=susede1 header.b=cP25jOTU; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233336AbhBQOPq (ORCPT + 99 others); Wed, 17 Feb 2021 09:15:46 -0500 Received: from mx2.suse.de ([195.135.220.15]:35852 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232908AbhBQOPj (ORCPT ); Wed, 17 Feb 2021 09:15:39 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1613571292; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zrNRTe46UspWVm0C7Y/cZDBRLIXFQ95FjJ33Q06xdsM=; b=cP25jOTUqYSksYP99Y7VQjj7v3RIfnEFoTafYYEOPpkn44j7UdssGRezRJ7XzYV+AnF+g2 Xc9XiYZLERkaPJdt7/GjnyXSy/jgtj5RiPMmYFhyP3/g2nKPcdpONUgZfXPD4h6Rg5G4pt c2d7iqBB79F288MM8QymPXmxFtfb/l8= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C751EB8FA; Wed, 17 Feb 2021 14:14:52 +0000 (UTC) Date: Wed, 17 Feb 2021 15:14:46 +0100 From: Michal Hocko To: David Hildenbrand Cc: Oscar Salvador , Andrew Morton , Mike Kravetz , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] mm: Make alloc_contig_range handle free hugetlb pages Message-ID: References: <20210217100816.28860-1-osalvador@suse.de> <20210217100816.28860-2-osalvador@suse.de> <182f6a4a-6f95-9911-7730-8718ab72ece2@redhat.com> <5f50c810-3f49-a162-6d1d-cf621c515f45@redhat.com> <5d70b340-2db0-ef1f-1564-e5d39354c11c@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5d70b340-2db0-ef1f-1564-e5d39354c11c@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 17-02-21 15:08:04, David Hildenbrand wrote: > On 17.02.21 14:59, Michal Hocko wrote: > > On Wed 17-02-21 14:53:37, David Hildenbrand wrote: > > > On 17.02.21 14:50, Michal Hocko wrote: > > [...] > > > > Do we have any real life examples? Or does this fall more into, let's > > > > optimize an existing implementation category. > > > > > > > > > > It's a big TODO item I have on my list and I am happy that Oscar is looking > > > into it. So yes, I noticed it while working on virtio-mem. It's real. > > > > Do not take me wrong, I am not opposing to the functionality. I am > > asking for the specific usecase. > > Makes sense, and a proper motivation should be included in the patches/cover > letter. So here comes a quick-n-dirty example: > > > Start a VM with 4G. Hotplug 1G via virtio-mem and online it to ZONE_MOVABLE. > Allocate 512 huge pages. > > [root@localhost ~]# cat /proc/meminfo > MemTotal: 5061512 kB > MemFree: 3319396 kB > MemAvailable: 3457144 kB > ... > HugePages_Total: 512 > HugePages_Free: 512 > HugePages_Rsvd: 0 > HugePages_Surp: 0 > Hugepagesize: 2048 kB > > > The huge pages get partially allocate from ZONE_MOVABLE. Try unplugging 1G > via virtio-mem (remember, all ZONE_MOVABLE). Inside the guest: > > [ 180.058992] alloc_contig_range: [1b8000, 1c0000) PFNs busy > [ 180.060531] alloc_contig_range: [1b8000, 1c0000) PFNs busy > [ 180.061972] alloc_contig_range: [1b8000, 1c0000) PFNs busy > [ 180.063413] alloc_contig_range: [1b8000, 1c0000) PFNs busy > [ 180.064838] alloc_contig_range: [1b8000, 1c0000) PFNs busy > [ 180.065848] alloc_contig_range: [1bfc00, 1c0000) PFNs busy > [ 180.066794] alloc_contig_range: [1bfc00, 1c0000) PFNs busy > [ 180.067738] alloc_contig_range: [1bfc00, 1c0000) PFNs busy > [ 180.068669] alloc_contig_range: [1bfc00, 1c0000) PFNs busy > [ 180.069598] alloc_contig_range: [1bfc00, 1c0000) PFNs busy > > > I succeed in unplugging 540MB - 484 MB remain blocked by huge pages ("which > did not end up there by pure luck"). These pages are movable (and even > free!) and can easily be reallocated. OK, this sounds reasonable. -- Michal Hocko SUSE Labs