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=-17.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 074AFC433E0 for ; Thu, 11 Feb 2021 10:40:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 720FB64EC9 for ; Thu, 11 Feb 2021 10:40:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 720FB64EC9 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 C58B36B00B6; Thu, 11 Feb 2021 05:40:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BE3806B00B7; Thu, 11 Feb 2021 05:40:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AAAC56B00B8; Thu, 11 Feb 2021 05:40:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0084.hostedemail.com [216.40.44.84]) by kanga.kvack.org (Postfix) with ESMTP id 916796B00B6 for ; Thu, 11 Feb 2021 05:40:20 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 51A36180AD807 for ; Thu, 11 Feb 2021 10:40:20 +0000 (UTC) X-FDA: 77805642600.22.mass24_0a0afd727618 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 1E98A18038E68 for ; Thu, 11 Feb 2021 10:40:20 +0000 (UTC) X-HE-Tag: mass24_0a0afd727618 X-Filterd-Recvd-Size: 3997 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Thu, 11 Feb 2021 10:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613040019; 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=C7w87EGIcqQNAgMWAkXHJEIhirP3piOjKUPZyA5QhDUIAjutuO51ICs7URYm1yIZJpD7/t fB/JXkIPLPbYSl/axeXYjT8nxjQR3dYCqDkAlKEcEoZsdJsXF7xnep8988NEyeGlPJtWP0 +ehdPX9Juk1wmPM2fPWCVKTLm+rSkGE= 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 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 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