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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 E1D49C433DB for ; Wed, 17 Feb 2021 14:16:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A4A1664E4A for ; Wed, 17 Feb 2021 14:16:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232884AbhBQOQB (ORCPT ); Wed, 17 Feb 2021 09:16:01 -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