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=-15.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 B6498C433E0 for ; Wed, 10 Feb 2021 08:56:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3F82164E28 for ; Wed, 10 Feb 2021 08:56:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F82164E28 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B3DA36B0006; Wed, 10 Feb 2021 03:56:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AC6D96B006C; Wed, 10 Feb 2021 03:56:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9904C6B006E; Wed, 10 Feb 2021 03:56:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0044.hostedemail.com [216.40.44.44]) by kanga.kvack.org (Postfix) with ESMTP id 7F3296B0006 for ; Wed, 10 Feb 2021 03:56:47 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 468A91859E306 for ; Wed, 10 Feb 2021 08:56:47 +0000 (UTC) X-FDA: 77801752854.17.shirt27_3501dc02760e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 2D5A91859E213 for ; Wed, 10 Feb 2021 08:56:47 +0000 (UTC) X-HE-Tag: shirt27_3501dc02760e X-Filterd-Recvd-Size: 4064 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Wed, 10 Feb 2021 08:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612947406; 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=HuJkwrKM+SC/P2HcDffuGQrd7Q8pyCyuUgvfR1Xy8GE=; b=fVbU4wtKi8vsULtpfg04iRThChvQqu1O/zhKEXtJLP2xFmVR/xGybrT058m0JJGAirF+FQ gPWi+8JnqjON09Jt+PHJzBMPXRrKbSGj9NfNDLW1xiqopwUzfJVBDYUW/TK/ZEtMJ1t59g H1kVoHgdhl7rcfNN+gVog1r1xryJ4+g= 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-105-1Uc8UV5dOC2F56yh31crsg-1; Wed, 10 Feb 2021 03:56:41 -0500 X-MC-Unique: 1Uc8UV5dOC2F56yh31crsg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4E609CC620; Wed, 10 Feb 2021 08:56:40 +0000 (UTC) Received: from [10.36.113.218] (ovpn-113-218.ams2.redhat.com [10.36.113.218]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9A8319CAC; Wed, 10 Feb 2021 08:56:38 +0000 (UTC) To: Oscar Salvador , Mike Kravetz 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> From: David Hildenbrand Organization: Red Hat GmbH Subject: Re: [RFC PATCH 1/2] mm,page_alloc: Make alloc_contig_range handle in-use hugetlb pages Message-ID: <6aa21eb3-7bee-acff-8f3c-7c13737066ba@redhat.com> Date: Wed, 10 Feb 2021 09:56:37 +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: <20210208103812.32056-2-osalvador@suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Content-Transfer-Encoding: quoted-printable 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 08.02.21 11:38, 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. >=20 > For now, do it only when coming from alloc_contig_range. >=20 > Signed-off-by: Oscar Salvador > --- > mm/compaction.c | 17 +++++++++++++++++ > mm/vmscan.c | 5 +++-- > 2 files changed, 20 insertions(+), 2 deletions(-) >=20 > 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; > } > =20 > + /* > + * Handle hugetlb pages only when coming from alloc_contig > + */ > + if (PageHuge(page) && cc->alloc_contig) { > + if (page_count(page)) { I wonder if we should care about races here. What if someone=20 concurrently allocates/frees? Note that PageHuge() succeeds on tail pages, isolate_huge_page() not, i=20 assume we'll have to handle that as well. I wonder if it would make sense to move some of the magic to hugetlb=20 code and handle it there with less chances for races (isolate if used,=20 alloc-and-dissolve if not). > + /* > + * Hugetlb page in-use. Isolate and migrate. > + */ > + if (isolate_huge_page(page, &cc->migratepages)) { > + low_pfn +=3D compound_nr(page) - 1; > + goto isolate_success_no_list; > + } > + } --=20 Thanks, David / dhildenb