Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3018607pxb; Tue, 19 Jan 2021 11:30:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwS5SfbcDOPbkg95yzyziDiHb0iLjvI8f8aKHHkuo4HOE2qiRISpX1q/psRurBULsvnw211 X-Received: by 2002:aa7:cfd7:: with SMTP id r23mr4561098edy.298.1611084627238; Tue, 19 Jan 2021 11:30:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611084627; cv=none; d=google.com; s=arc-20160816; b=O4sohwJPa5dWK3WQnXNcsq2eTwZBG8PwgENZuWd2pFrMTtvx5iJlsV4pvmzxRAT+Sm rrQrVzGXl1riAE96LahkuH7RpLgxgLg8ZLIyrFUzokTQ67Fwv+ENxLLdqrCvba2bhH8N PUvDTFYFf2Ad1n80f2V+Wj8vOA5NqjhRLXtoC1SoXy60Ejg5YV89lcbd0Bb7OP2Efc0V 4JxOt716KISdrIIoAfnCTJCq5KDCyL2fA1zJHFbWZh83LvfCiOLNnr2+f28w7SHKvFuI Wcu5uSqO0mC50mFQcLWThiAHXslAq5mTEN1uSWiFMWyY2J6uvzR9GWWqJwsrt3SLFxd9 NiHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=hfjS8PpIK8Sw4H2BcFdwSk9imrJFBiUObKqAE346rrk=; b=laynqjJhNl4IGW0HOir1GVPRkUmAZGL0xO+OZbq2UzKd3DlhPbkthwhkIaL7vThwcs Mzhx/xiIKzWmb7vpQvGK9QTLoPhZJYlJrRtJBvHD3CNSfnFxzG7TSVwP/BiPkhO9qsny yGkBKttw3vhafnxss/EkL3rpJwmbGQ+bnWLtwGT1IKuj55xlt4EETNgrNfkQwttSQinV LQxR7gtLMJPTI+nVSgBiC4UV/p2EeolFBZQdSK87aCDUJy32f3U4Skaw6VZf7Pv7Y5mv oJX90XZUFKVm9KO7LLhsETBbygIlrEJiK5NkamiCwXXNIbxLfkVQ+qOM/V+b+RuLDtsA NzGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jyZa03UY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z4si2571520ejx.753.2021.01.19.11.29.53; Tue, 19 Jan 2021 11:30:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jyZa03UY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391994AbhAST1z (ORCPT + 99 others); Tue, 19 Jan 2021 14:27:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392147AbhAST0w (ORCPT ); Tue, 19 Jan 2021 14:26:52 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 898FFC061573 for ; Tue, 19 Jan 2021 11:26:12 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id w14so3852046pfi.2 for ; Tue, 19 Jan 2021 11:26:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=hfjS8PpIK8Sw4H2BcFdwSk9imrJFBiUObKqAE346rrk=; b=jyZa03UY8jzWno2ByRrYjgjIuxfrx8l6GP0hi8fyQo1ibeyOebB//A/mTKgQk8fLOk kV3jtIUFrA5uLcVGBtVIXP/+sM51GSwpXGMHSIXIQLkJ9xojm+qZNkDcYruKKsrO/8Fi 1ZXeflrRW7G3tUdtxoKWm0qaXcR0gPonGzp2DvuY/XlYsRflR2P19m1xaEwXAtWe6LJw uAkCj5qCL7hdEl2V4MwSj1idaEwSL2s8fViYo18/Lqk7Z612cms7cyZhI8k7bLYoEzQz VB3ResK/cl0l4jjet8E6r1hopiVM9BlmBuMjAABJJZBcwcaFJX4TzDvK4ddji7zbZwnL tHDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=hfjS8PpIK8Sw4H2BcFdwSk9imrJFBiUObKqAE346rrk=; b=DdhX6n732jnTvkESvF43LzI1+reUkula7kwHlA3l7TnOeYPPwYbHmxd+k5IMdU7J1K rFn00JPcUsCzUiR3sO/3xvWaSuHEHbnEIuXAFFh/x7uMsPymPhAcfv3H1IVXSiTrCubs n/crSxIBtGFhOz0Oo9wub6Tc/DG4Mj8hAusvszC61uLm8Be6s3YpEjBbhgZTnlI7lykJ mByQntfihp5x9nlE5GNylY722PDMBg82at2+akoerhZ1CrT+zIqmzepLQ2TvOcT4+1Eq FbmYuxAF4AlsXn4j3ZN6KSirUHxXVlbPvcN+PrgEDqzn81XzYq1Y2XXXsqdVUaB7kCHW +Vwg== X-Gm-Message-State: AOAM532YBVQp/v0XxU7eZRNR3ObSPvZnG288GrqxfinllNZVVol9VHsB POY8sMrRuTulmmKaCHXakqvOmQ== X-Received: by 2002:a63:1b1e:: with SMTP id b30mr5791504pgb.421.1611084370066; Tue, 19 Jan 2021 11:26:10 -0800 (PST) Received: from [2620:15c:17:3:4a0f:cfff:fe51:6667] ([2620:15c:17:3:4a0f:cfff:fe51:6667]) by smtp.gmail.com with ESMTPSA id a9sm19569815pfn.178.2021.01.19.11.26.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 11:26:09 -0800 (PST) Date: Tue, 19 Jan 2021 11:26:08 -0800 (PST) From: David Rientjes To: Charan Teja Reddy cc: akpm@linux-foundation.org, vbabka@suse.cz, mhocko@suse.com, khalid.aziz@oracle.com, ngupta@nitingupta.dev, vinmenon@codeaurora.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V3] mm/compaction: correct deferral logic for proactive compaction In-Reply-To: <1610989938-31374-1-git-send-email-charante@codeaurora.org> Message-ID: References: <1610989938-31374-1-git-send-email-charante@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 18 Jan 2021, Charan Teja Reddy wrote: > should_proactive_compact_node() returns true when sum of the > weighted fragmentation score of all the zones in the node is greater > than the wmark_high of compaction, which then triggers the proactive > compaction that operates on the individual zones of the node. But > proactive compaction runs on the zone only when its weighted > fragmentation score is greater than wmark_low(=wmark_high - 10). > > This means that the sum of the weighted fragmentation scores of all the > zones can exceed the wmark_high but individual weighted fragmentation > zone scores can still be less than wmark_low which makes the unnecessary > trigger of the proactive compaction only to return doing nothing. > > Issue with the return of proactive compaction with out even trying is > its deferral. It is simply deferred for 1 << COMPACT_MAX_DEFER_SHIFT if > the scores across the proactive compaction is same, thinking that > compaction didn't make any progress but in reality it didn't even try. Isn't this an issue in deferred compaction as well? It seems like deferred compaction should check that work was actually performed before deferring subsequent calls to compaction. In other words, I don't believe deferred compaction is intended to avoid checks to determine if compaction is worth it; it should only defer *additional* work that was not productive. Thoughts? > With the delay between successive retries for proactive compaction is > 500msec, it can result into the deferral for ~30sec with out even trying > the proactive compaction. > > Test scenario is that: compaction_proactiveness=50 thus the wmark_low = > 50 and wmark_high = 60. System have 2 zones(Normal and Movable) with > sizes 5GB and 6GB respectively. After opening some apps on the android, > the weighted fragmentation scores of these zones are 47 and 49 > respectively. Since the sum of these fragmentation scores are above the > wmark_high which triggers the proactive compaction and there since the > individual zones weighted fragmentation scores are below wmark_low, it > returns without trying the proactive compaction. As a result the > weighted fragmentation scores of the zones are still 47 and 49 which > makes the existing logic to defer the compaction thinking that > noprogress is made across the compaction. > > Fix this by checking just zone fragmentation score, not the weighted, in > __compact_finished() and use the zones weighted fragmentation score in > fragmentation_score_node(). In the test case above, If the weighted > average of is above wmark_high, then individual score (not adjusted) of > atleast one zone has to be above wmark_high. Thus it avoids the > unnecessary trigger and deferrals of the proactive compaction. > > Fix-suggested-by: Vlastimil Babka Suggested-by > Signed-off-by: Charan Teja Reddy Acked-by: David Rientjes