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 210BAC433DB for ; Wed, 17 Feb 2021 14:14:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C06B464E4D for ; Wed, 17 Feb 2021 14:14:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C06B464E4D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4419C6B006E; Wed, 17 Feb 2021 09:14:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F2248D0002; Wed, 17 Feb 2021 09:14:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32FCF8D0001; Wed, 17 Feb 2021 09:14:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0054.hostedemail.com [216.40.44.54]) by kanga.kvack.org (Postfix) with ESMTP id 20CA16B006E for ; Wed, 17 Feb 2021 09:14:55 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D608D87EC for ; Wed, 17 Feb 2021 14:14:54 +0000 (UTC) X-FDA: 77827956108.21.wax65_01085452764d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 9314F180445F8 for ; Wed, 17 Feb 2021 14:14:54 +0000 (UTC) X-HE-Tag: wax65_01085452764d X-Filterd-Recvd-Size: 4107 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Wed, 17 Feb 2021 14:14:53 +0000 (UTC) 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> 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 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