From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753307AbcEMMhx (ORCPT ); Fri, 13 May 2016 08:37:53 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35776 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753267AbcEMMhv (ORCPT ); Fri, 13 May 2016 08:37:51 -0400 Date: Fri, 13 May 2016 14:37:48 +0200 From: Michal Hocko To: Vlastimil Babka Cc: linux-mm@kvack.org, Andrew Morton , Joonsoo Kim , Rik van Riel , David Rientjes , Mel Gorman , Johannes Weiner , Tetsuo Handa , linux-kernel@vger.kernel.org, Linus Torvalds Subject: Re: [RFC 07/13] mm, compaction: introduce direct compaction priority Message-ID: <20160513123748.GM20141@dhcp22.suse.cz> References: <1462865763-22084-1-git-send-email-vbabka@suse.cz> <1462865763-22084-8-git-send-email-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1462865763-22084-8-git-send-email-vbabka@suse.cz> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 10-05-16 09:35:57, Vlastimil Babka wrote: > In the context of direct compaction, for some types of allocations we would > like the compaction to either succeed or definitely fail while trying as hard > as possible. Current async/sync_light migration mode is insufficient, as there > are heuristics such as caching scanner positions, marking pageblocks as > unsuitable or deferring compaction for a zone. At least the final compaction > attempt should be able to override these heuristics. > > To communicate how hard compaction should try, we replace migration mode with > a new enum compact_priority and change the relevant function signatures. In > compact_zone_order() where struct compact_control is constructed, the priority > is mapped to suitable control flags. This patch itself has no functional > change, as the current priority levels are mapped back to the same migration > modes as before. Expanding them will be done next. > > Note that !CONFIG_COMPACTION variant of try_to_compact_pages() is removed, as > the only caller exists under CONFIG_COMPACTION. Your s-o-b is missing Anyway I like the idea. The migration_mode felt really weird. It exposes an internal detail of the compaction code which should have no business in the allocator path. Acked-by: Michal Hocko > --- > include/linux/compaction.h | 18 +++++++++--------- > mm/compaction.c | 14 ++++++++------ > mm/page_alloc.c | 27 +++++++++++++-------------- > 3 files changed, 30 insertions(+), 29 deletions(-) > > diff --git a/include/linux/compaction.h b/include/linux/compaction.h > index 4ba90e74969c..900d181ff1b0 100644 > --- a/include/linux/compaction.h > +++ b/include/linux/compaction.h > @@ -1,6 +1,14 @@ > #ifndef _LINUX_COMPACTION_H > #define _LINUX_COMPACTION_H > > +// TODO: lower value means higher priority to match reclaim, makes sense? Yes this makes sense to me. > +enum compact_priority { enums might be tricky but I guess it should work ok here. I would just add COMPACT_MIN_PRIO, > + COMPACT_PRIO_SYNC_LIGHT = COMPACT_MIN_PRIO, > + DEF_COMPACT_PRIORITY = COMPACT_PRIO_SYNC_LIGHT, > + COMPACT_PRIO_ASYNC, > + INIT_COMPACT_PRIORITY = COMPACT_PRIO_ASYNC > +}; > + to make an implementation independent lowest priority. [...] > @@ -3269,11 +3269,11 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags, > /* > * compaction considers all the zone as desperately out of memory > * so it doesn't really make much sense to retry except when the > - * failure could be caused by weak migration mode. > + * failure could be caused by insufficient priority > */ > if (compaction_failed(compact_result)) { > - if (*migrate_mode == MIGRATE_ASYNC) { > - *migrate_mode = MIGRATE_SYNC_LIGHT; > + if (*compact_priority > 0) { if (*compact_priority > COMPACT_MIN_PRIO) > + (*compact_priority)--; > return true; > } > return false; -- Michal Hocko SUSE Labs