Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2040236pxb; Thu, 11 Feb 2021 02:46:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZG5mKl9MtLWVjwjgfqjtA+h/SFr7FQXpMI6d/o+fgXLNe+N9s9kghMWbrIVlsrmeqYugM X-Received: by 2002:a17:906:ca15:: with SMTP id jt21mr3212431ejb.58.1613040377525; Thu, 11 Feb 2021 02:46:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613040377; cv=none; d=google.com; s=arc-20160816; b=OiCXZ6YljK92WVEXjJCbyMkgz+5/sbFm/TmRL3CnL5lkq2b+F3qPklja/86n6u9Eln wAGHE3cocWZzJa/U/wGQZJU0irHwhSWaNQ8macSktw2WMdDJyb+sSEiAC6Ys6q4ayRYf IwL+WS26Dw1rT5E6r1rX3MI4dan0E90WbhgKyRD9ot8Yt+cXAKbXVrtp0MnpZFWME4Le NlhvYmgAnNjbNZocbaPGJYoLPlpX4dzSCB0LANDQp6uPyMNQcgp4MXrv8N2JYKQRlw27 RHG2sUBlWLA61/enoE1UN/pniZ1Pug69r7hg/09cpxNbBtenH0OpIQ2EoiYRmXwz6YPG 56Uw== 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:organization :from:references:cc:to:subject:dkim-signature; bh=oLC7a4i0K7MCY0/uq/IzIb60MqNgbIOajiBNYOXcbB4=; b=wQIwuk15CJ0figz2+cOQFD6hrqF9yh/CyQV4UEKJZjpwA8ybBqIKv9BUHfXQ6P6om+ CAaRNhghDrACmCucfx5MKBAHCGM6qFIYeYifi5rDpxFSLTNqWBYmrqzM0l9JWi4Sbi9/ F52fidP239ZQgYzUkWGqhFFS4RWqGe7yT8CtKmuyXLBtdoBKjR4naoSvLAq5FilomQXg TiC9OI/DYniREiOZq+8o8yGHuPdfsZkaIBVvSxCAbyVJt7y8kbexZ/+nTVl19+1lZSBe c5jxYi5bUdikaBzmUBUFTp7hPs95kJOB6OQNyspUyxsUkf1oHQqr3xzoDpnATY9QNpOv DygQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Z+oR/Dhx"; 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 m9si3570115eji.536.2021.02.11.02.45.54; Thu, 11 Feb 2021 02:46:17 -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="Z+oR/Dhx"; 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 S230094AbhBKKog (ORCPT + 99 others); Thu, 11 Feb 2021 05:44:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57278 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230346AbhBKKlr (ORCPT ); Thu, 11 Feb 2021 05:41:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613040021; 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=oLC7a4i0K7MCY0/uq/IzIb60MqNgbIOajiBNYOXcbB4=; b=Z+oR/DhxEET4AxuPd3uwDViVXYXqBMy4s6psAOM1Abi1CumAQjqjW1gogYMwQnkJwYYug6 4P+l1uF3ndxfrn/nQZO1mfLeMFgNu/oHIRYM0wyfJOFKc+lf3OpD29UC2ev6S4aMVb34AU 8Xt2CxvEww+rdPjL8j7LOdht7DL9KrM= 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-85-Gj-iRevKOk-_LL1hW5n8tg-1; Thu, 11 Feb 2021 05:40:16 -0500 X-MC-Unique: Gj-iRevKOk-_LL1hW5n8tg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5ADAA100CCC0; Thu, 11 Feb 2021 10:40:15 +0000 (UTC) Received: from [10.36.114.52] (ovpn-114-52.ams2.redhat.com [10.36.114.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 239E710016F7; Thu, 11 Feb 2021 10:40:13 +0000 (UTC) Subject: Re: [RFC PATCH 1/2] mm,page_alloc: Make alloc_contig_range handle in-use hugetlb pages To: Mike Kravetz , Oscar Salvador Cc: Muchun Song , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20210208103812.32056-1-osalvador@suse.de> <20210208103812.32056-2-osalvador@suse.de> <6783e871-e981-c845-16c3-c5ff3e6502ed@oracle.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <007046e9-4655-42d1-0422-6a210f726eff@redhat.com> Date: Thu, 11 Feb 2021 11:40:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <6783e871-e981-c845-16c3-c5ff3e6502ed@oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11.02.21 01:56, Mike Kravetz wrote: > On 2/8/21 2:38 AM, Oscar Salvador wrote: >> alloc_contig_range is not prepared to handle hugetlb pages and will >> fail if it ever sees one, but since they can be migrated as any other >> page (LRU and Movable), it makes sense to also handle them. >> >> For now, do it only when coming from alloc_contig_range. >> >> Signed-off-by: Oscar Salvador >> --- >> mm/compaction.c | 17 +++++++++++++++++ >> mm/vmscan.c | 5 +++-- >> 2 files changed, 20 insertions(+), 2 deletions(-) >> >> diff --git a/mm/compaction.c b/mm/compaction.c >> index e5acb9714436..89cd2e60da29 100644 >> --- a/mm/compaction.c >> +++ b/mm/compaction.c >> @@ -940,6 +940,22 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, >> goto isolate_fail; >> } >> >> + /* >> + * Handle hugetlb pages only when coming from alloc_contig >> + */ >> + if (PageHuge(page) && cc->alloc_contig) { >> + if (page_count(page)) { > > Thanks for doing this! > > I agree with everything in the discussion you and David had. This code > is racy, but since we are scanning lockless there is no way to eliminate > them all. Best to just minimize the windows and document. > Agreed - and make sure that we don't have strange side. (e.g., in the next patch, allocate a new page, try to dissolve. Dissolving fails, what happens to the just-allocated page?) -- Thanks, David / dhildenb