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=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_RED, USER_IN_DEF_DKIM_WL 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 CD86EC433DB for ; Sun, 24 Jan 2021 18:02:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3ECDC22C9C for ; Sun, 24 Jan 2021 18:02:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3ECDC22C9C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 62F646B0005; Sun, 24 Jan 2021 13:02:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E14F6B0006; Sun, 24 Jan 2021 13:02:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F6F96B0007; Sun, 24 Jan 2021 13:02:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id 3653A6B0005 for ; Sun, 24 Jan 2021 13:02:05 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E366B8249980 for ; Sun, 24 Jan 2021 18:02:04 +0000 (UTC) X-FDA: 77741437368.03.north54_4a04cb42757f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id C2F7F28A4E9 for ; Sun, 24 Jan 2021 18:02:04 +0000 (UTC) X-HE-Tag: north54_4a04cb42757f X-Filterd-Recvd-Size: 4924 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Sun, 24 Jan 2021 18:02:04 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id q12so14506070lfo.12 for ; Sun, 24 Jan 2021 10:02:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=qhc7cnz0RKFXOf698IrJkfakceVLloqd5WmltfYsgto=; b=ZC2/TGkDAYL98/DPFpoGdIc7/hZCRHLxArcJi5wFjJoAPBnlzdizpyFoz+c3Sl8x4F NT6pR18r4pfdOGhZZoJ2rkz25i+QptDZaPtUt8kYuKTgsKfbKZPAIcCippOJJiErqq8n 386umxMzxipEa0drs+PoarwmbHL7Da9zCu7GEVHLfj9VytPDwsYKWkG9ukZTXIOVxLPl 1TAcp9r7QMMhYO0LB96sDSSQMG3oEOXaL+rpUjAoeSKf9Q5rqw7msEpiCkDB+2OIU7M9 xdx4j/Et7XG4Og4iAH/5+bDuvYphX1VHjcnMbL6/FVGTyGcNMBYCh55qpZ8aAhKi77xK DREw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=qhc7cnz0RKFXOf698IrJkfakceVLloqd5WmltfYsgto=; b=rOGMXH8nzdWu/ekDN9AcEW7Ag5VJIxKFtp/LUS9kNjzMCuedZrS0MPrDjdUU7CwAKo xBJoQruH8QcvpjqLYcwEsF5Csus7MciAQRDXErTAQKDf9flPsLlWZY8a4DqxjwPgMbxe JpGw553KPHm2A1KDeYq4JwJMTwyb/Qo/O1NufLre/vxVKcPgNnfwDU2Kittrdu3N3eRY HL7ZZNMYsaB+VHRcG35mKd3nu7F5rIB27qbewKfkhgrPMWX263WjgOu/lRzTFYW4Y8NG uUraGiHLrH2vWTsawOh27bUlAKo+00JYJa7nv86OuNVO6/zNHc3HsAg6D6BsecDoZXW/ xlCg== X-Gm-Message-State: AOAM530FSb1J/MXsSDqOgks33JApM8IapfYGb7umGoMI0J80CY+BRers EtQE0+SiVa0vHswosfKIWWnY+GchYMaFwojIrXLPCA== X-Google-Smtp-Source: ABdhPJxu5eVM/lKokhkCxod5AjChPP5/rCoA3Q4eaevWLtFpplMXPwX8bkxls7c8I5NQJ3UMRT6dol7p1SIoFmtYKv8= X-Received: by 2002:a19:644b:: with SMTP id b11mr610105lfj.358.1611511322517; Sun, 24 Jan 2021 10:02:02 -0800 (PST) MIME-Version: 1.0 References: <20210123210029.a7c704d0cab204683e41ad10@linux-foundation.org> <20210124050119.34lm1Gw1Q%akpm@linux-foundation.org> In-Reply-To: <20210124050119.34lm1Gw1Q%akpm@linux-foundation.org> From: Shakeel Butt Date: Sun, 24 Jan 2021 10:01:51 -0800 Message-ID: Subject: Re: [patch 06/19] mm: memcontrol: prevent starvation when writing memory.high To: Andrew Morton Cc: Roman Gushchin , Johannes Weiner , Linux MM , Michal Hocko , =?UTF-8?Q?Michal_Koutn=C3=BD?= , mm-commits@vger.kernel.org, stable@vger.kernel.org, Tejun Heo , Linus Torvalds Content-Type: text/plain; charset="UTF-8" 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: On Sat, Jan 23, 2021 at 9:01 PM Andrew Morton w= rote: > > From: Johannes Weiner > Subject: mm: memcontrol: prevent starvation when writing memory.high > > When a value is written to a cgroup's memory.high control file, the > write() context first tries to reclaim the cgroup to size before putting > the limit in place for the workload. Concurrent charges from the workloa= d > can keep such a write() looping in reclaim indefinitely. > > In the past, a write to memory.high would first put the limit in place fo= r > the workload, then do targeted reclaim until the new limit has been met - > similar to how we do it for memory.max. This wasn't prone to the > described starvation issue. However, this sequence could cause excessive > latencies in the workload, when allocating threads could be put into long > penalty sleeps on the sudden memory.high overage created by the write(), > before that had a chance to work it off. > > Now that memory_high_write() performs reclaim before enforcing the new > limit, reflect that the cgroup may well fail to converge due to concurren= t > workload activity. Bail out of the loop after a few tries. > > Link: https://lkml.kernel.org/r/20210112163011.127833-1-hannes@cmpxchg.or= g > Fixes: 536d3bf261a2 ("mm: memcontrol: avoid workload stalls when lowering= memory.high") > Signed-off-by: Johannes Weiner > Reviewed-by: Shakeel Butt > Reported-by: Tejun Heo > Acked-by: Roman Gushchin > Reviewed-by: Michal Koutn=C3=BD > Cc: Michal Hocko > Cc: [5.8+] > Signed-off-by: Andrew Morton Johannes requested to replace this patch with https://lore.kernel.org/linux-mm/20210122184341.292461-1-hannes@cmpxchg.org= /