From patchwork Fri Jan 4 12:50:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 10748337 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A9F1513B5 for ; Fri, 4 Jan 2019 12:53:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95E9C2844C for ; Fri, 4 Jan 2019 12:53:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89F9228471; Fri, 4 Jan 2019 12:53:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB1962844C for ; Fri, 4 Jan 2019 12:53:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 162ED8E00E5; Fri, 4 Jan 2019 07:53:38 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0EA718E00AE; Fri, 4 Jan 2019 07:53:38 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F1D378E00E5; Fri, 4 Jan 2019 07:53:37 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 9465D8E00AE for ; Fri, 4 Jan 2019 07:53:37 -0500 (EST) Received: by mail-ed1-f71.google.com with SMTP id z10so35109614edz.15 for ; Fri, 04 Jan 2019 04:53:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=i8TN/NXWm8K+VVHHC6gi+xYMTRXd4mPWvACQisViumU=; b=F5BpFXBmfAF6/AgRYxdjIINTXE9jd+cfgxJG9yxLcUbdNU3hDAG3OzoaPj3PAMbIwi MA7hbv2/ojbuY6JMFWgLmBnmifKJvLgNu7YXQPcK9AsMiJk7pwwaIEk4herIvXtXxfqd qdBlFGwZ4dQuAT/LC3YQp9XwPPo/pFJneX4D36YAz8zHsKJI+igMKnWQ5ZMc5ayzOQLV UiK7dbDTPVfLyldxiKwkoBbcQpmw7tMUE6nANGJ9Xi2WX+4VvZcMXC0a3SHzNE3Nr2Jj 52GGwfSVZ1pffW4e+CJygK2P+nu7jWRZp+50A4w12WwMNO4jwY8he2VS5fcIJSRgIFtI GCiQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.193 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Gm-Message-State: AA+aEWYoCYPAplK5dTD5Kuo/8Rf7YzqwFx1Ne6LKuRws9xpkiS8+5c/Y xyztN2Ej0LmHXQUPGCfUA8mkM2nFZl+mtCKpigPT8JbQBWludPOYTtH0zupP6RqLQRZjwr7Mnx7 w7yf5qNH6TOpj1QS+IerZ/0Hr20EKLGD21YVJSB8Kn0UVm9GtFXRecFuiSjWFptGIUw== X-Received: by 2002:a50:9315:: with SMTP id m21mr45578790eda.58.1546606417090; Fri, 04 Jan 2019 04:53:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/XZTlPxVrSklqVr229yJkFlGsc1eQy1q2BToMoqgZAi6Bju/p+BvSyBiKeXVPqIgCr0gCrW X-Received: by 2002:a50:9315:: with SMTP id m21mr45578755eda.58.1546606416210; Fri, 04 Jan 2019 04:53:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546606416; cv=none; d=google.com; s=arc-20160816; b=mcgAA0f/Ly8iAML6A/vYB9KmZ5wWBGYxvgcgCDBEubYTi15qWTLRVqPE28gcyr/72/ r6xJXPzZ/sHQPZicl/mX+0YxcHN7nweFbGexWHVHwXOmXEwVUBBSWj8WfhPvermh1nBN 892vKdu54uGw8RZ982JELyFj5bthSeoph6c9dsodditl6kAZvsm4dFR5T9odJFehf4q5 rb47IA6VWJVUbfRtyERMjFfRSwNmJwSAq+zj/0Gappq0bnk6kaZ3MUpWJuPLe8Glxo9Q rO57cjlE2EmbXyPnPhTqpLy99jaaLeRZc+lY1g/cRN2lA4DB057Q8U0WRnwF+igLA0Il t7Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=i8TN/NXWm8K+VVHHC6gi+xYMTRXd4mPWvACQisViumU=; b=XwuIUmnL2mFvivtFV+tIJ+r1228qU8LzM6tP0SGZ+Iush8XP2prZt7H+OgqmbfQQ1R CnFtD92HAQyoaXM+7lEho5YKO9mrNJvSm59G7lYCjtAp7zKdTpTqHIeDAsiQjeVFjdt/ d/vyb5kVug4F9VB2opu4cu01rLI5CSv7OKpvQPOtBM+qeYi5XAR2xBbelJx/SSO92sEa JJZI+cAztFIqUdwX2u+gudsp96pd1fI7M0EwhAsCvgpTIvQcuibr3FTJWKSwzzq2NRLj 9DtBHMlHAuMKafIHZ9YbBIOZ2uDL7Ro72P72URhO+VXcAEL4AakhlJbJbuONkjHKO90B 1W4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.193 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from outbound-smtp25.blacknight.com (outbound-smtp25.blacknight.com. [81.17.249.193]) by mx.google.com with ESMTPS id i46si3118602eda.288.2019.01.04.04.53.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Jan 2019 04:53:36 -0800 (PST) Received-SPF: pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.193 as permitted sender) client-ip=81.17.249.193; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.193 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp25.blacknight.com (Postfix) with ESMTPS id D7616B87A3 for ; Fri, 4 Jan 2019 12:53:35 +0000 (GMT) Received: (qmail 8538 invoked from network); 4 Jan 2019 12:53:35 -0000 Received: from unknown (HELO stampy.163woodhaven.lan) (mgorman@techsingularity.net@[37.228.229.96]) by 81.17.254.9 with ESMTPA; 4 Jan 2019 12:53:35 -0000 From: Mel Gorman To: Linux-MM Cc: David Rientjes , Andrea Arcangeli , Vlastimil Babka , ying.huang@intel.com, kirill@shutemov.name, Andrew Morton , Linux List Kernel Mailing , Mel Gorman Subject: [PATCH 19/25] mm, compaction: Do not consider a need to reschedule as contention Date: Fri, 4 Jan 2019 12:50:05 +0000 Message-Id: <20190104125011.16071-20-mgorman@techsingularity.net> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190104125011.16071-1-mgorman@techsingularity.net> References: <20190104125011.16071-1-mgorman@techsingularity.net> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Scanning on large machines can take a considerable length of time and eventually need to be rescheduled. This is treated as an abort event but that's not appropriate as the attempt is likely to be retried after making numerous checks and taking another cycle through the page allocator. This patch will check the need to reschedule if necessary but continue the scanning. The main benefit is reduced scanning when compaction is taking a long time or the machine is over-saturated. It also avoids an unnecessary exit of compaction that ends up being retried by the page allocator in the outer loop. 4.20.0 4.20.0 synccached-v2r15 noresched-v2r15 Amean fault-both-3 2655.55 ( 0.00%) 2736.50 ( -3.05%) Amean fault-both-5 4580.67 ( 0.00%) 4133.70 ( 9.76%) Amean fault-both-7 5740.50 ( 0.00%) 5738.61 ( 0.03%) Amean fault-both-12 9237.55 ( 0.00%) 9392.82 ( -1.68%) Amean fault-both-18 12899.51 ( 0.00%) 13257.15 ( -2.77%) Amean fault-both-24 16342.47 ( 0.00%) 16859.44 ( -3.16%) Amean fault-both-30 20394.26 ( 0.00%) 16249.30 * 20.32%* Amean fault-both-32 17450.76 ( 0.00%) 14904.71 * 14.59%* Signed-off-by: Mel Gorman Acked-by: Vlastimil Babka --- mm/compaction.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 1a41a2dbff24..75eb0d40d4d7 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -398,19 +398,11 @@ static bool compact_lock_irqsave(spinlock_t *lock, unsigned long *flags, return true; } -/* - * Aside from avoiding lock contention, compaction also periodically checks - * need_resched() and records async compaction as contended if necessary. - */ +/* Avoid soft-lockups due to long scan times */ static inline void compact_check_resched(struct compact_control *cc) { - /* async compaction aborts if contended */ - if (need_resched()) { - if (cc->mode == MIGRATE_ASYNC) - cc->contended = true; - + if (need_resched()) cond_resched(); - } } /*