Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3721610pxb; Mon, 24 Jan 2022 16:18:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzPulYDBOpqaW4P/ryUF0bjJazx7TZBKLH+L66rHKhUr0xxErw62xOwQOD8x3tOTqXFUTZh X-Received: by 2002:a17:90a:53:: with SMTP id 19mr792183pjb.159.1643069928517; Mon, 24 Jan 2022 16:18:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643069928; cv=none; d=google.com; s=arc-20160816; b=09rbkeBJsRrOxdB9niMHJaHj9NAF9+7rMORqjRcqwcAv+c5nmoMhCW/8PuE9N0X5fr 0P8IFYRAhLDttXGmsQ5jNpPuocbn2C7FnE01xozZolX0tNZ1OR7xXMhSCJuZHmEdvXyh 3VV11bO2O3WKzJgltFahvAM309QteAac9n+9kxhhwvee8pCFFz/juD6vJPW4rgD/HpFC EemGwTijmt3p2ZJQj2o5Fyr2GkKWpVdaXvtISar6lZk98H21tQF79Hp3jcSOMWI6v8G5 xRjjatye/Riz465Rr7dqjPLC0paR3kPkNgEnNOmUGl27UwEGW3Hwxe36fJtGV69ZWXmG euTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2zlTsNrJWiNsku3mssQcnfQ/gn4Se0eT+DSDheizGJ4=; b=lUUFUaVKElt8OtfRyjw1rrlsQbuoEFbLdcvDpisn6IG0s6uLEz6iEyhBuzj5F7qBsZ cM/m0HhhsquLmBRTqSaGgCywXCyRsYfO8IBROx7CP/evBWWsr+CyAV+AGr0GLmZpmEjM n4lQsGqD8PsPW/r/qtLgHYDmZZD4rbHPmCoWAqhGP35P823NJXiwHcRE/7oGNA9JJ9up 6nU0sP0jJ9b5Hogsrf2Q/FAoNJfuw8OWReJXDCiQDi3+jRPOGZhzTlKds2PDq5BWVPc9 Z3mo56iC9isw8F38oLU8aQHAy9ZszRQZKonVdF/z4VFG/VZ9pxV4KIFtftwXGdDVayNJ HOdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Zve/PpyJ"; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a3si13277107pgc.510.2022.01.24.16.18.36; Mon, 24 Jan 2022 16:18:48 -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=@linuxfoundation.org header.s=korg header.b="Zve/PpyJ"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2373240AbiAYANY (ORCPT + 99 others); Mon, 24 Jan 2022 19:13:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1850695AbiAXXah (ORCPT ); Mon, 24 Jan 2022 18:30:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C815EC0AD1AF; Mon, 24 Jan 2022 13:35:01 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 65DB4614CB; Mon, 24 Jan 2022 21:35:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 765A0C340E4; Mon, 24 Jan 2022 21:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060100; bh=Y3b/AAusapEvGqBUnrjEZn2kCsA/rAJP2AKEvANrqow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zve/PpyJAOaHE0zIjdDplWV/Wj4t36U4Tz9hf/Tx+ygX+8/1ZaJryE1cq0LSYbe4I ViGtOkmwp5kd7dUfY43pffbMeFHj79RcKjVV5BhZ9ophpQ6YK3ftBnbhzgMeMiTHIT 5Da9xoGAMSoLvx/E0hKrBKV6ZJcuUFklYWS0dJSw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Wandun , Oscar Salvador , Vlastimil Babka , Joonsoo Kim , Wang Kefeng , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.16 0832/1039] mm/page_isolation: unset migratetype directly for non Buddy page Date: Mon, 24 Jan 2022 19:43:41 +0100 Message-Id: <20220124184153.249107968@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen Wandun [ Upstream commit 721fb891ad0b3956d5c168b2931e3e5e4fb7ca40 ] In unset_migratetype_isolate(), we can bypass the call to move_freepages_block() for non-buddy pages. It will save a few cpu cycles for some situations such as cma and hugetlb when allocating continue pages, in these situation function alloc_contig_pages will be called. alloc_contig_pages __alloc_contig_migrate_range isolate_freepages_range ==> pages has been remove from buddy undo_isolate_page_range unset_migratetype_isolate ==> can directly set migratetype [osalvador@suse.de: changelog tweak] Link: https://lkml.kernel.org/r/20211229033649.2760586-1-chenwandun@huawei.com Fixes: 3c605096d315 ("mm/page_alloc: restrict max order of merging on isolated pageblock") Signed-off-by: Chen Wandun Reviewed-by: Oscar Salvador Cc: Vlastimil Babka Cc: Joonsoo Kim Cc: Wang Kefeng Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- mm/page_isolation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_isolation.c b/mm/page_isolation.c index f67c4c70f17f6..6a0ddda6b3c53 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype) * onlining - just onlined memory won't immediately be considered for * allocation. */ - if (!isolated_page) { + if (!isolated_page && PageBuddy(page)) { nr_pages = move_freepages_block(zone, page, migratetype, NULL); __mod_zone_freepage_state(zone, nr_pages, migratetype); } -- 2.34.1