Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755309AbbHKIvU (ORCPT ); Tue, 11 Aug 2015 04:51:20 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:48778 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755088AbbHKIvP convert rfc822-to-8bit (ORCPT ); Tue, 11 Aug 2015 04:51:15 -0400 X-AuditID: cbfee691-f79ca6d00000456a-35-55c9b78084ec From: PINTU KUMAR To: "'Vlastimil Babka'" , "'PINTU KUMAR'" , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, "'Andrew Morton'" , "'Hugh Dickins'" , "'Andrea Arcangeli'" , "'Kirill A. Shutemov'" , "'Rik van Riel'" , "'Mel Gorman'" , "'David Rientjes'" , "'Joonsoo Kim'" , cpgs@samsung.com, pintu.k@outlook.com References: <1438619141-22215-1-git-send-email-vbabka@suse.cz> <1086308416.1472237.1439134679684.JavaMail.yahoo@mail.yahoo.com> <55C8726E.4090103@suse.cz> In-reply-to: <55C8726E.4090103@suse.cz> Subject: RE: [RFC v3 1/2] mm, compaction: introduce kcompactd Date: Tue, 11 Aug 2015 14:20:23 +0530 Message-id: <03f801d0d412$d56cedd0$8046c970$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 8BIT X-Mailer: Microsoft Outlook 14.0 Thread-index: AQFEVmXZXy5Z1Kh+E+yWLznH8TMCCgKjJV1BAgu0JKGe+NYoUA== Content-language: en-us X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgleLIzCtJLcpLzFFi42JZI2JSrduw/WSowY4TghYL1i9lt5izfg2b xctDmhZPP/WxWKzsbmazuPl8DovF5V1z2CzurfnPajH53TNGi/Mdl1ktvr29zW7x98p6Fou2 JRuZLGY39jE68Hks2FTqsenTJHaPrrdXmDxOzPjN4jHvZKDH5tcvmD3e77vK5tG3ZRWjx5kF R9g9Np+u9vi8Sc5j1qzDTAE8U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oSwxpxQoFJBYXKykb4dpQmiIm64FTGOErm9IEFyPkQEaSFjD mHFl3hTGgtnqFZdX/GZvYJwv38XIySEhYCLRevYnK4QtJnHh3nq2LkYuDiGBWYwSz9r3MUM4 bxklGp+eAqri4GATUJc4doAXpEFEIFXi6uHvjCA1zALTmSV23e2D6p7HKDH3yAw2kAZOoIYf T81AGoQFbCXmXJzMBBJmEVCV+PCsHiTMK2Ap8WjHJXYIW1Dix+R7LCA2M1DnpHmLmCFsbYkn 7y5AHaogsePsa0aIG5wkbv76zApRIy4x6cFD9gmMQrOQjJqFZNQsJKNmIWlZwMiyilEitSC5 oDgpPdcwL7Vcrzgxt7g0L10vOT93EyM4TT2T2sF4cJf7IUYBDkYlHl4Bz5OhQqyJZcWVuYcY JTiYlUR4C6cChXhTEiurUovy44tKc1KLDzGaAv06kVlKNDkfmELzSuINjU3MTY1NLU0sTMws lcR5ZTdsDhUSSE8sSc1OTS1ILYLpY+LglGpgVF7NEbhDp1Vi/cMNH14xLv3hWJHJ9sVcdf6E OcX/vt7xrjKLYoxubeDK1/ufsstqeUmSUmOKe/PrFr7JE89tyF5Xb1YvxKui8yyhQN66cpZl 0jnPA7OUsgXez2L3PLZoBa9wVLGCu+a7l8HvLySwmR0pvvm1da5SifwyNef9H14t3hEW/z9N iaU4I9FQi7moOBEAQiUQMWkDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5038 Lines: 107 Hi, > -----Original Message----- > From: Vlastimil Babka [mailto:vbabka@suse.cz] > Sent: Monday, August 10, 2015 3:14 PM > To: PINTU KUMAR; linux-mm@kvack.org > 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 > Subject: Re: [RFC v3 1/2] mm, compaction: introduce kcompactd > > 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? > No, I mean in slowpath, after kswapd, there is already direct_compact/reclaim. > > 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. > But, if kswapd is disabled then even kcompactd will not be called. Then it will be same situation. Just a thought, how about creating a kworker thread for performing kcompactd? May be schedule it on demand (based on current fragmentation level of COSTLY_ORDER), from other sub-system. Or, may be invoke it when direct_reclaim fails. Because, as per my observation, running compaction, immediately after reclaim gives more benefit. How about tracking all higher order in kernel and understand who actually needs it. > > 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? > CMA has its own limitations and drawbacks (because of movable pages criteria). Please check this: https://lkml.org/lkml/2014/5/7/810 So, for low RAM devices we try to make CMA as tight and low as possible. For IOMMU supported devices (camera etc.), we don’t need CMA. For Android case, they use ION system heap that rely on higher-order (with fallback mechanism), then perform scatter/gather. For more information, please check this: drivers/staging/android/ion/ion_system_heap.c > > 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. Specially, I would like to see the results on low RAM (less than 512M). I will also share if I get anything interesting. Thanks. -- 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/