From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753713AbdBNKI2 (ORCPT ); Tue, 14 Feb 2017 05:08:28 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:39256 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753692AbdBNKIZ (ORCPT ); Tue, 14 Feb 2017 05:08:25 -0500 Message-ID: <58A2D6F9.6030400@huawei.com> Date: Tue, 14 Feb 2017 18:07:53 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Vlastimil Babka CC: , Johannes Weiner , Joonsoo Kim , David Rientjes , Mel Gorman , , Subject: Re: [PATCH v2 04/10] mm, page_alloc: count movable pages when stealing from pageblock References: <20170210172343.30283-1-vbabka@suse.cz> <20170210172343.30283-5-vbabka@suse.cz> In-Reply-To: <20170210172343.30283-5-vbabka@suse.cz> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.58A2D712.0356,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 130079b43e98e41fcf773b0183775e01 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/2/11 1:23, Vlastimil Babka wrote: > When stealing pages from pageblock of a different migratetype, we count how > many free pages were stolen, and change the pageblock's migratetype if more > than half of the pageblock was free. This might be too conservative, as there > might be other pages that are not free, but were allocated with the same > migratetype as our allocation requested. > > While we cannot determine the migratetype of allocated pages precisely (at > least without the page_owner functionality enabled), we can count pages that > compaction would try to isolate for migration - those are either on LRU or > __PageMovable(). The rest can be assumed to be MIGRATE_RECLAIMABLE or > MIGRATE_UNMOVABLE, which we cannot easily distinguish. This counting can be > done as part of free page stealing with little additional overhead. > > The page stealing code is changed so that it considers free pages plus pages > of the "good" migratetype for the decision whether to change pageblock's > migratetype. > > The result should be more accurate migratetype of pageblocks wrt the actual > pages in the pageblocks, when stealing from semi-occupied pageblocks. This > should help the efficiency of page grouping by mobility. > > Signed-off-by: Vlastimil Babka Hi Vlastimil, How about these two changes? 1. If we steal some free pages, we will add these page at the head of start_migratetype list, it will cause more fixed, because these pages will be allocated more easily. So how about use list_move_tail instead of list_move? __rmqueue_fallback steal_suitable_fallback move_freepages_block move_freepages list_move 2. When doing expand() - list_add(), usually the list is empty, but in the following case, the list is not empty, because we did move_freepages_block() before. __rmqueue_fallback steal_suitable_fallback move_freepages_block // move to the list of start_migratetype expand // split the largest order list_add // add to the list of start_migratetype So how about use list_add_tail instead of list_add? Then we can merge the large block again as soon as the page freed. Thanks, Xishi Qiu