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.8 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,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 ED994C433E0 for ; Tue, 5 Jan 2021 18:05:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 87F6122CF8 for ; Tue, 5 Jan 2021 18:05:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87F6122CF8 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 1A2D88D008D; Tue, 5 Jan 2021 13:05:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 152918D006E; Tue, 5 Jan 2021 13:05:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0699B8D008D; Tue, 5 Jan 2021 13:05:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0074.hostedemail.com [216.40.44.74]) by kanga.kvack.org (Postfix) with ESMTP id E45FD8D006E for ; Tue, 5 Jan 2021 13:05:24 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B11A1180AD81F for ; Tue, 5 Jan 2021 18:05:24 +0000 (UTC) X-FDA: 77672498568.02.beast60_5415bcf274da Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 95CA010097AA0 for ; Tue, 5 Jan 2021 18:05:24 +0000 (UTC) X-HE-Tag: beast60_5415bcf274da X-Filterd-Recvd-Size: 4165 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Tue, 5 Jan 2021 18:05:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609869923; 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=UESOViXeUqqgxTdJOAvu5P6aSrx26z1BgEX3o3McZLI=; b=h7jYFsrJAdotdSOXeHHOojFsgNAvnNG58bBttbFrdemqzQZ5czPlshrX90lc59LEIFxB5S 62XYTIZm92QpMQslUVrmSEUqBsJ2y+NEo2EWHtfufs7pFOYejV5qcdq+fiGt3wMRsyEzdE L0J2uIs3NRAEsK1OaMJpCSkuDmHwWmM= 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-365-wVG8_QOEOE2lzpYxfpzJkw-1; Tue, 05 Jan 2021 13:05:18 -0500 X-MC-Unique: wVG8_QOEOE2lzpYxfpzJkw-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 5B4A984A5E0; Tue, 5 Jan 2021 18:05:16 +0000 (UTC) Received: from [10.36.114.117] (ovpn-114-117.ams2.redhat.com [10.36.114.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1A5D1F46F; Tue, 5 Jan 2021 18:05:13 +0000 (UTC) Subject: Re: [PATCH 1/6] mm: migrate: do not migrate HugeTLB page whose refcount is one To: Yang Shi Cc: Muchun Song , Mike Kravetz , Andrew Morton , hillf.zj@alibaba-inc.com, Naoya Horiguchi , ak@linux.intel.com, yongjun_wei@trendmicro.com.cn, mhocko@suse.cz, Linux MM , Linux Kernel Mailing List References: <20210104065843.5658-1-songmuchun@bytedance.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Tue, 5 Jan 2021 19:05:12 +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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 05.01.21 19:04, Yang Shi wrote: > On Tue, Jan 5, 2021 at 8:58 AM David Hildenbrand wrote: >> >> On 04.01.21 07:58, Muchun Song wrote: >>> If the refcount is one when it is migrated, it means that the page >>> was freed from under us. So we are done and do not need to migrate. >>> >>> Signed-off-by: Muchun Song >>> --- >>> mm/migrate.c | 6 ++++++ >>> 1 file changed, 6 insertions(+) >>> >>> diff --git a/mm/migrate.c b/mm/migrate.c >>> index 4385f2fb5d18..a6631c4eb6a6 100644 >>> --- a/mm/migrate.c >>> +++ b/mm/migrate.c >>> @@ -1279,6 +1279,12 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, >>> return -ENOSYS; >>> } >>> >>> + if (page_count(hpage) == 1) { >>> + /* page was freed from under us. So we are done. */ >>> + putback_active_hugepage(hpage); >>> + return MIGRATEPAGE_SUCCESS; >>> + } >>> + >>> new_hpage = get_new_page(hpage, private); >>> if (!new_hpage) >>> return -ENOMEM; >>> >> >> This series seems to fix quite some important cases (thanks). Do we want >> to cc stable some/all? > > For this particular one, I don't think so IMHO. It is an optimization > rather than a bug fix. I'm rather referring to the actual fixes (I received no cover letter so I picked the first patch in the series) -- Thanks, David / dhildenb