From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5644AC433E0 for ; Tue, 19 May 2020 17:19:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 16C7120709 for ; Tue, 19 May 2020 17:19:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="JfArE+Dc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16C7120709 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C26488000C; Tue, 19 May 2020 13:19:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BFF2C8000B; Tue, 19 May 2020 13:19:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B16618000C; Tue, 19 May 2020 13:19:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id 9BF468000B for ; Tue, 19 May 2020 13:19:47 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 58C3C2495 for ; Tue, 19 May 2020 17:19:47 +0000 (UTC) X-FDA: 76834130814.08.rifle66_7285f639b8c05 X-HE-Tag: rifle66_7285f639b8c05 X-Filterd-Recvd-Size: 3228 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Tue, 19 May 2020 17:19:46 +0000 (UTC) Received: from kicinski-fedora-PC1C0HJN.thefacebook.com (unknown [163.114.132.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6AEBC20842; Tue, 19 May 2020 17:19:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589908786; bh=zU6BYtpx72jVihkxFVAWHDj5teHYoyigohzs9US3qOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JfArE+DcUqMaPPcH22CmjeNr+UUcveoCTLxPwwCXAl4yzL4t/o8xCIn/rC0bu6w1t FIQx4izTk1vUtqunaed9xnCxYL46+rhD6slzqJZ2qfV9L2HVIt7eyI66Jc+Ben4V0B mTW6IdrolslgP0tN6vnR5aW5YQGaeoD3obXlzh7s= From: Jakub Kicinski To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, kernel-team@fb.com, tj@kernel.org, hannes@cmpxchg.org, chris@chrisdown.name, cgroups@vger.kernel.org, shakeelb@google.com, mhocko@kernel.org, Jakub Kicinski Subject: [PATCH mm v4 2/4] mm: move penalty delay clamping out of calculate_high_delay() Date: Tue, 19 May 2020 10:19:36 -0700 Message-Id: <20200519171938.3569605-3-kuba@kernel.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200519171938.3569605-1-kuba@kernel.org> References: <20200519171938.3569605-1-kuba@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: We will want to call calculate_high_delay() twice - once for memory and once for swap, and we should apply the clamp value to sum of the penalties. Clamping has to be applied outside of calculate_high_delay(). Signed-off-by: Jakub Kicinski --- mm/memcontrol.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 0d05e6a593f5..dd8605a9137a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2367,14 +2367,7 @@ static unsigned long calculate_high_delay(struct m= em_cgroup *memcg, * MEMCG_CHARGE_BATCH pages is nominal, so work out how much smaller or * larger the current charge patch is than that. */ - penalty_jiffies =3D penalty_jiffies * nr_pages / MEMCG_CHARGE_BATCH; - - /* - * Clamp the max delay per usermode return so as to still keep the - * application moving forwards and also permit diagnostics, albeit - * extremely slowly. - */ - return min(penalty_jiffies, MEMCG_MAX_HIGH_DELAY_JIFFIES); + return penalty_jiffies * nr_pages / MEMCG_CHARGE_BATCH; } =20 /* @@ -2402,6 +2395,13 @@ void mem_cgroup_handle_over_high(void) penalty_jiffies =3D calculate_high_delay(memcg, nr_pages, mem_find_max_overage(memcg)); =20 + /* + * Clamp the max delay per usermode return so as to still keep the + * application moving forwards and also permit diagnostics, albeit + * extremely slowly. + */ + penalty_jiffies =3D min(penalty_jiffies, MEMCG_MAX_HIGH_DELAY_JIFFIES); + /* * Don't sleep if the amount of jiffies this memcg owes us is so low * that it's not even worth doing, in an attempt to be nice to those wh= o --=20 2.25.4