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 3749AC2D0EF for ; Fri, 17 Apr 2020 01:06:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F0C4220776 for ; Fri, 17 Apr 2020 01:06:47 +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="EwVvT4+5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0C4220776 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 EBED58E0006; Thu, 16 Apr 2020 21:06:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E95C68E0001; Thu, 16 Apr 2020 21:06:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D35518E0006; Thu, 16 Apr 2020 21:06:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0169.hostedemail.com [216.40.44.169]) by kanga.kvack.org (Postfix) with ESMTP id B562C8E0001 for ; Thu, 16 Apr 2020 21:06:44 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 72AEC5DD7 for ; Fri, 17 Apr 2020 01:06:44 +0000 (UTC) X-FDA: 76715557128.16.cast33_57eb7a633ec24 X-HE-Tag: cast33_57eb7a633ec24 X-Filterd-Recvd-Size: 3175 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Fri, 17 Apr 2020 01:06:44 +0000 (UTC) Received: from kicinski-fedora-PC1C0HJN.thefacebook.com (unknown [163.114.132.4]) (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 E3ED52223C; Fri, 17 Apr 2020 01:06:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587085603; bh=atn+uG1raVqgcSHz1jVAI4WGiZvnKZIhSS07qsE9/Rs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EwVvT4+5fMSy+zo4OcC+zP8T8hJMd156TkTFdpONYQ2O01c++xS+x7ytIq2AYo0fm 587NHboBDyfT71UTbfftaFUVy+Voc1xJkSF2Y7eo4IVs5/cj16Z+J5sCr4clpJJ79g F/URS5LCdTMeCqzr5HCjnlMkYF+NSXJqaniVW3P8= 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, Jakub Kicinski Subject: [PATCH 2/3] mm: move penalty delay clamping out of calculate_high_delay() Date: Thu, 16 Apr 2020 18:06:16 -0700 Message-Id: <20200417010617.927266-3-kuba@kernel.org> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200417010617.927266-1-kuba@kernel.org> References: <20200417010617.927266-1-kuba@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, 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 9bfb7dcb3489..90266c04fd76 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2384,14 +2384,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 /* @@ -2419,6 +2412,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.2