Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6497491pxb; Wed, 17 Feb 2021 06:15:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2QqeKynkTEgeib1c+TIqn1TfY25ZiKsZh3f+/zMUTbnwOE76x8co+2ezm6ATXH7SXAajM X-Received: by 2002:a17:907:a059:: with SMTP id gz25mr25993171ejc.400.1613571302629; Wed, 17 Feb 2021 06:15:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613571302; cv=none; d=google.com; s=arc-20160816; b=XrZsd5hdguu62yCaygdZpGA1sTV0Wh5amXv0HTCg7CVR0hQm0a2xI7/UYOocYMLjRM t2YMVryTL0/P0SZZJBulxIWUwB7RhXbu0D0rSqJ4d+3ilG/hxOxi4LXaaxdXkq350qpj 8TVTzdQ9Hi7Dsk1lsKZxhdP6RQ1xk19IOskkyAyQ5bYgz+2kdn5HYz6H+xTJjl3jbKRP k84zdN6apzN+3643Ha4pcssKd2zjxq5nB8xiM3rjeTK8ovXiNtRAXJ3v0+38ihvwvipP X/68vUN6Dv/KhqWBbz9OTjiwcFIbZ2qTZ36U6BLGt8RqFZTWXSnGon61IxXs3GtpLs92 5A1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject :organization:from:references:cc:to:dkim-signature; bh=P8RxsF8J5nDa+mgXtHAOtJY50kcCIvzbpkGeCGDBzqw=; b=LGReDbFIHLTZs/IlP1RxpUGPMsmWqerpBQ7zD0TqoKlfHNkAyCnUAln1s/ZPdRYemm Yvz67+Fh4ow4y47ggBm9OP1Ihrk7JIG6Zkehu7WTXxKx8ffNRJIkjE5c2KVNPdMmvbwy fRIEpz9zpvX7sjHJHvD7esI2UaW22KkrhNYOliv2RZPkYXYM4mvR+pVXgXrCr7CNseqs 1uyAllRt0jb9E3IciXjdhArU/8Bxbc83eH0Ue+SpdN796rmTGyVTcgBws9vaG9Rm6fcd XDqWkRj+q5O0i5duPluAhFl6uPSqn9Mfz/L0RGy/xpr8qBTUrGZEP/soA3ac7tWR6vaY hLmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="AKCuvn/0"; 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 q12si1570321ejs.148.2021.02.17.06.14.37; Wed, 17 Feb 2021 06:15:02 -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=@redhat.com header.s=mimecast20190719 header.b="AKCuvn/0"; 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 S233391AbhBQOKH (ORCPT + 99 others); Wed, 17 Feb 2021 09:10:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54969 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233319AbhBQOJj (ORCPT ); Wed, 17 Feb 2021 09:09:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613570892; 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=P8RxsF8J5nDa+mgXtHAOtJY50kcCIvzbpkGeCGDBzqw=; b=AKCuvn/0gcVrqQvRMbJ43BAaLhdTwqv73mVLPtmwYPCv4zfJKWOkr2qf9YywumHB850SVd B0EUNHlTlVIK3cEsVSuz8Q9LPXm8wocXh6cvGFQOu5fitjiUNwdS+trCsc2voUhha9MjkG FOXG5UHf8dL1TuA72gn8tSmWWyBliYk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-487-OmuYUHRBNk-It2J9Wo7O9g-1; Wed, 17 Feb 2021 09:08:08 -0500 X-MC-Unique: OmuYUHRBNk-It2J9Wo7O9g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED4C46D4F7; Wed, 17 Feb 2021 14:08:06 +0000 (UTC) Received: from [10.36.114.178] (ovpn-114-178.ams2.redhat.com [10.36.114.178]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5911719C46; Wed, 17 Feb 2021 14:08:05 +0000 (UTC) To: Michal Hocko Cc: Oscar Salvador , Andrew Morton , Mike Kravetz , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org 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> From: David Hildenbrand Organization: Red Hat GmbH Subject: Re: [PATCH 1/2] mm: Make alloc_contig_range handle free hugetlb pages Message-ID: <5d70b340-2db0-ef1f-1564-e5d39354c11c@redhat.com> Date: Wed, 17 Feb 2021 15:08:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Thanks, David / dhildenb