From patchwork Wed Aug 23 15:31:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 805057 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3xcryJ2FN7z9s7m; Thu, 24 Aug 2017 01:32:08 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1dkXdU-0007Rn-Sz; Wed, 23 Aug 2017 15:32:04 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dkXdK-0007PZ-U8 for kernel-team@lists.ubuntu.com; Wed, 23 Aug 2017 15:31:54 +0000 Received: from 1.general.ppisati.uk.vpn ([10.172.193.134] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1dkXdK-0000DL-KO for kernel-team@lists.ubuntu.com; Wed, 23 Aug 2017 15:31:54 +0000 From: Paolo Pisati To: kernel-team@lists.ubuntu.com Subject: [PATCH 3/5] Revert "Revert "mm, oom: protect !costly allocations some more for !CONFIG_COMPACTION"" Date: Wed, 23 Aug 2017 17:31:50 +0200 Message-Id: <1503502312-24673-4-git-send-email-paolo.pisati@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503502312-24673-1-git-send-email-paolo.pisati@canonical.com> References: <1503502312-24673-1-git-send-email-paolo.pisati@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com BugLink: http://bugs.launchpad.net/bugs/1712598 This reverts commit 7b84469d8206394eace2ce2fc04417bb69b0f012. Signed-off-by: Paolo Pisati --- mm/page_alloc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 7460e81..ebaf218 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2927,6 +2927,24 @@ should_compact_retry(struct alloc_context *ac, unsigned int order, int alloc_fla enum migrate_mode *migrate_mode, int compaction_retries) { + struct zone *zone; + struct zoneref *z; + + if (!order || order > PAGE_ALLOC_COSTLY_ORDER) + return false; + + /* + * There are setups with compaction disabled which would prefer to loop + * inside the allocator rather than hit the oom killer prematurely. + * Let's give them a good hope and keep retrying while the order-0 + * watermarks are OK. + */ + for_each_zone_zonelist_nodemask(zone, z, ac->zonelist, ac->high_zoneidx, + ac->nodemask) { + if (zone_watermark_ok(zone, 0, min_wmark_pages(zone), + ac->classzone_idx, alloc_flags)) + return true; + } return false; } #endif /* CONFIG_COMPACTION */