Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp939719pxk; Fri, 25 Sep 2020 01:43:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycnidVU2B9Q1RBWoJymLD98mZNHyYGaCE2NvfU/odgNjHzLxZLK9+pJZQ3lQwcO04aIbn6 X-Received: by 2002:aa7:c154:: with SMTP id r20mr103130edp.337.1601023404836; Fri, 25 Sep 2020 01:43:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601023404; cv=none; d=google.com; s=arc-20160816; b=TECtlYJujMZG33PrOmBjgp2eSClEcgTibPKDP7lrer3vjChAYtFi5KOI6d4tjpp/Rp /pam6Jj4N9PB4SddhE0yGt4HKFXhMXtK7DXwfdkYZqnz5vY1HPbIanfhX1JXmvdJk5yN pjjuKSGFjiUUITmJpOP1EUyE5tnxP5GTjM6brQYFDZaHPs21ZVRsLdERq3/duEtcJW7a JxDeUIXg2QV2/IC/VWytSXBfXvfBBmrKjqFzwC46/Jq4SU2+I2N+88CfblxX5Z1s3Qw8 vXv3BdBjRAh8WndpvWqoiGbAvaEfUcrv3ZGbToTRzR03zw7YxUodH8P9FXI9Tk3nrUI+ fDpw== 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:from:references :cc:to:subject; bh=j+tgsM6UOC5HKuuJNqYbwpaJfeyPQoRLOCpPal3CAFs=; b=ZE/k136tTBIzckjFm1MS/53T/N3xW3rPWQmTb9e/nDTOUg3OWx70qJMZ0i+HnMELrz XvRkwxnUqw3OpVZhkaY0n4dBZNuF4Sh2f91REkq9UjJvRvvYSTGjjZmGtd0ozUlbx8MD 3NGlc3sIJc0cXeCttwloKsYw+LR7IG+bd+hYWd8d4B696LR5fd71urzz0hQii6LQ57tR JG6YGnvQ6CPSfSuubDGxbXL5JIsgofPieotyvyiSL3kiyWlyagcAAfku4k7b9LMeLh2f Oa50nJEXdfOQTbzXtsrRSJuf/1S3eURnPLRfIUqALLJe5bT93mbv7BTIE/AD5amFlY7N MVYQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p9si1341644ejx.463.2020.09.25.01.43.01; Fri, 25 Sep 2020 01:43:24 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727772AbgIYIjh (ORCPT + 99 others); Fri, 25 Sep 2020 04:39:37 -0400 Received: from mx2.suse.de ([195.135.220.15]:46898 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727395AbgIYIjg (ORCPT ); Fri, 25 Sep 2020 04:39:36 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 511CDB29D; Fri, 25 Sep 2020 08:39:35 +0000 (UTC) Subject: Re: [PATCH RFC 3/4] mm/page_alloc: always move pages to the tail of the freelist in unset_migratetype_isolate() To: David Hildenbrand , Wei Yang Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-hyperv@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, Andrew Morton , Alexander Duyck , Mel Gorman , Michal Hocko , Dave Hansen , Oscar Salvador , Mike Rapoport , Scott Cheloha , Michael Ellerman References: <20200916183411.64756-1-david@redhat.com> <20200916183411.64756-4-david@redhat.com> <9c6cc094-b02a-ac6c-e1ca-370ce7257881@suse.cz> <20200925024552.GA13540@L-31X9LVDL-1304.local> From: Vlastimil Babka Message-ID: <8e9a4427-3c95-22f5-1e0b-5e3c9fa86592@suse.cz> Date: Fri, 25 Sep 2020 10:39:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/25/20 10:05 AM, David Hildenbrand wrote: >>>> static inline void del_page_from_free_list(struct page *page, struct zone *zone, >>>> unsigned int order) >>>> { >>>> @@ -2323,7 +2332,7 @@ static inline struct page *__rmqueue_cma_fallback(struct zone *zone, >>>> */ >>>> static int move_freepages(struct zone *zone, >>>> struct page *start_page, struct page *end_page, >>>> - int migratetype, int *num_movable) >>>> + int migratetype, int *num_movable, bool to_tail) >>>> { >>>> struct page *page; >>>> unsigned int order; >>>> @@ -2354,7 +2363,10 @@ static int move_freepages(struct zone *zone, >>>> VM_BUG_ON_PAGE(page_zone(page) != zone, page); >>>> >>>> order = page_order(page); >>>> - move_to_free_list(page, zone, order, migratetype); >>>> + if (to_tail) >>>> + move_to_free_list_tail(page, zone, order, migratetype); >>>> + else >>>> + move_to_free_list(page, zone, order, migratetype); >>>> page += 1 << order; >>>> pages_moved += 1 << order; >>>> } >>>> @@ -2362,8 +2374,9 @@ static int move_freepages(struct zone *zone, >>>> return pages_moved; >>>> } >>>> >>>> -int move_freepages_block(struct zone *zone, struct page *page, >>>> - int migratetype, int *num_movable) >>>> +static int __move_freepages_block(struct zone *zone, struct page *page, >>>> + int migratetype, int *num_movable, >>>> + bool to_tail) >>>> { >>>> unsigned long start_pfn, end_pfn; >>>> struct page *start_page, *end_page; >>>> @@ -2384,7 +2397,20 @@ int move_freepages_block(struct zone *zone, struct page *page, >>>> return 0; >>>> >>>> return move_freepages(zone, start_page, end_page, migratetype, >>>> - num_movable); >>>> + num_movable, to_tail); >>>> +} >>>> + >>>> +int move_freepages_block(struct zone *zone, struct page *page, >>>> + int migratetype, int *num_movable) >>>> +{ >>>> + return __move_freepages_block(zone, page, migratetype, num_movable, >>>> + false); >>>> +} >>>> + >>>> +int move_freepages_block_tail(struct zone *zone, struct page *page, >>>> + int migratetype) >>>> +{ >>>> + return __move_freepages_block(zone, page, migratetype, NULL, true); >>>> } >>> >>> Likewise, just 5 callers of move_freepages_block(), all in the files you're >>> already changing, so no need for this wrappers IMHO. > > As long as we don't want to move the implementation to the header, we'll > need it for the constant propagation to work at compile time (we don't > really have link-time optimizations). Or am I missing something? I guess move_freepages_block() is not exactly fast path, so we could do without it. > Thanks! >