Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754467AbbHJJoW (ORCPT ); Mon, 10 Aug 2015 05:44:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:56739 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753564AbbHJJoT (ORCPT ); Mon, 10 Aug 2015 05:44:19 -0400 Subject: Re: [RFC v3 1/2] mm, compaction: introduce kcompactd To: PINTU KUMAR , "linux-mm@kvack.org" References: <1438619141-22215-1-git-send-email-vbabka@suse.cz> <1086308416.1472237.1439134679684.JavaMail.yahoo@mail.yahoo.com> Cc: "linux-kernel@vger.kernel.org" , Andrew Morton , Hugh Dickins , Andrea Arcangeli , "Kirill A. Shutemov" , Rik van Riel , Mel Gorman , David Rientjes , Joonsoo Kim , Pintu Kumar From: Vlastimil Babka Message-ID: <55C8726E.4090103@suse.cz> Date: Mon, 10 Aug 2015 11:44:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1086308416.1472237.1439134679684.JavaMail.yahoo@mail.yahoo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3305 Lines: 69 On 08/09/2015 05:37 PM, PINTU KUMAR wrote: >> Waking up of the kcompactd threads is also tied to kswapd activity and follows >> these rules: >> - we don't want to affect any fastpaths, so wake up kcompactd only from the >> slowpath, as it's done for kswapd >> - if kswapd is doing reclaim, it's more important than compaction, so >> don't >> invoke kcompactd until kswapd goes to sleep >> - the target order used for kswapd is passed to kcompactd >> >> The kswapd compact/reclaim loop for high-order pages is left alone for now >> and precedes kcompactd wakeup, but this might be revisited later. > > kcompactd, will be really nice thing to have, but I oppose calling it from kswapd. > Because, just after kswapd, we already have direct_compact. Just to be clear, here you mean that kswapd already does the compact/reclaim loop? > So it may end up in doing compaction 2 times. The compact/reclaim loop might already do multiple iterations. The point is, kswapd will terminate the loop as soon as single page of desired order becomes available. Kcompactd is meant to go beyond that. And having kcompactd run in parallel with kswapd's reclaim looks like nonsense to me, so I don't see other way than have kswapd wake up kcompactd when it's finished. > Or, is it like, with kcompactd, we dont need direct_compact? That will have to be evaluated. It would be nice to not need the compact/reclaim loop, but I'm not sure it's always possible. We could move it to kcompactd, but it would still mean that no daemon does exclusively just reclaim or just compaction. > In embedded world situation is really worse. > As per my experience in embedded world, just compaction does not help always in longer run. > > As I know there are already some Android model in market, that already run background compaction (from user space). > But still there are sluggishness issues due to bad memory state in the long run. It should still be better with background compaction than without it. Of course, avoiding a permanent fragmentation completely is not possible to guarantee as it depends on the allocation patterns. > In embedded world, the major problems are related to camera and browser use cases that requires almost order-8 allocations. > Also, for low RAM configurations (less than 512M, 256M etc.), the rate of failure of compaction is much higher than the rate of success. I was under impression that CMA was introduced to deal with such high-order requirements in the embedded world? > How can we guarantee that kcompactd is suitable for all situations? We can't :) we can only hope to improve the average case. Anything that needs high-order *guarantees* has to rely on CMA or another kind of reservation (yeah even CMA is a pageblock reservation in some sense). > In an case, we need large amount of testing to cover all scenarios. > It should be called at the right time. > I dont have any data to present right now. > May be I will try to capture some data, and present here. That would be nice. I'm going to collect some as well. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/