Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp13627pxb; Tue, 12 Jan 2021 18:30:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAvENCVkTroIH3quBz1c838UaVbz7UP6ZEYB4CGKhX9jbk/L0yCAAdtTlM8MUzFiWUMXNg X-Received: by 2002:a17:906:4e45:: with SMTP id g5mr1214788ejw.391.1610505001323; Tue, 12 Jan 2021 18:30:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610505001; cv=none; d=google.com; s=arc-20160816; b=N3n8fJotKOP7OA20Ki2oX+c6kFQBU8YBHpt9s8Tub23EU9qVwb6pxpmwvG5WAVJi0X x0q9Eq9urVdPCTiPCwtIeJrWEGhcKFWkEYV+OrxpvyioPS3gAxAMku4yivRI5fBO6OcL jiPUXKkC2qU3cZV9vq7xnIMO7csF6gc9CuuccgwIVlvIHVhDbU2D20obuZlrxzuKgwzC g5JSeqPg+cnvFIQlftfeEzdAKLM+QfhB0g9vn72LEJOLuOvEQcMqeStKtc8BE9BtyLme XPynI+xCM8u5tghMnUGCJIjgNli+fNRLVDvvZuQuHTGge52yPNCiUg26DpGmTuTDRGl2 XJCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=r3RcTfMe7SWAKR9ZPaILuwCLkjEw52kXwdvMKFbxE+Y=; b=KaiNHMhOJhjyZfzy38EtxBdH00+1UpgmvyjHlWHoxAr3GObkb5ywIck2ivbfk42df2 gUvrFBXCnBwIxN4ptUgXN/eWVMbwn6moiNfVCSo4a6muRFPOs6TlVDb1iiRtuEVDLTpu mTlUONtOrBeE7+SFqS+gBibTDVPvGxB5VqAeWInAUvOWDcKtVNEWcHVVuq5EU2z7cHG/ PeAAnSqlV7+oxzuujo3GVbY+nFvqGI1VOEgUC+2OJNn6OPmBATz+THqS33gmi9Uv2nnH F36O3UO+nfM6wZhLDWovp2Pl1KzLW6A7sjgMJVvuMClCo1kqpm3+MMI47Ei4lThLHjbd 0Iaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=xNb+jXyy; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id no7si248875ejb.586.2021.01.12.18.29.37; Tue, 12 Jan 2021 18:30:01 -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=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=xNb+jXyy; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406694AbhALT4N (ORCPT + 99 others); Tue, 12 Jan 2021 14:56:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406683AbhALT4M (ORCPT ); Tue, 12 Jan 2021 14:56:12 -0500 Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6965EC061786 for ; Tue, 12 Jan 2021 11:55:32 -0800 (PST) Received: by mail-qk1-x729.google.com with SMTP id z11so3035522qkj.7 for ; Tue, 12 Jan 2021 11:55:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=r3RcTfMe7SWAKR9ZPaILuwCLkjEw52kXwdvMKFbxE+Y=; b=xNb+jXyynOtMDGYrXvcjUcO1CyQWacGxvJvRvEKyedu3WJVOTOZbv25S2m8yr5PD/y esanXfysmROgybxXxP9XniQQQPP+U2ROGwezs7psAGDv45Xpm5aWrVI8oSxAVXF1XtCn j5i8fxDNcSlJlDnjAONEV3qx3q4PnJeW4KW1ON266+jtRWCH+DPrg2eRcpmlBAutB4/a zBURoO0FdYjVF4uJ1NUQ1lfOMejaHhbbPKJeIoEd394wvVxBNxnPBewf6fmWsbc25Qg+ SDeiRf0JkL/dhE75JqCf1XLpbdDd2fNM/edlnqtoxuKLhsbdAoz1qszvoTfX+R/IRXXI yQEg== 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:message-id:references :mime-version:content-disposition:in-reply-to; bh=r3RcTfMe7SWAKR9ZPaILuwCLkjEw52kXwdvMKFbxE+Y=; b=XOhabUtZp7BYwh61kg+cMtAMSoAMpZc1XjpOA5JlzqWe9jb/x4CuOxLnk8+C50mnul Yr3A9w2DWwdehREFkmqKWq8u1/ex5E7FV6hWewN03RpD03JDZqw1FJjxUdhTN2A82IRX /B5EdKEC1As6aknZJ9p1EsJLiljc9+rWE+jmle2rUWqSeFI05zRNKMuQJDLI+ZftJYw4 fMra53uQvx1yGCdXokEmnE/1SDbeqS1rfvayzuCGnJPVei09P1hWzyGhDMYDpgvjdoJT DiVQveWQvTznkViJy7eg06zZXcjW9hFLHIFE8VnDV9h2ai4KVKx67i7DVIH2AoxzhyRl sGtg== X-Gm-Message-State: AOAM533HSNaAJ5gQR86Gj8cutxk3N1H+UoREPBd5PFjVxorz0Z43mq6L Q2Rq0e4/goFsQ0qDzxfSvDCBjQ== X-Received: by 2002:a37:6382:: with SMTP id x124mr1081695qkb.398.1610481331701; Tue, 12 Jan 2021 11:55:31 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:1fb4]) by smtp.gmail.com with ESMTPSA id 127sm1937307qkj.51.2021.01.12.11.55.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 11:55:31 -0800 (PST) Date: Tue, 12 Jan 2021 14:53:06 -0500 From: Johannes Weiner To: Shakeel Butt Cc: Andrew Morton , Tejun Heo , Roman Gushchin , Michal Hocko , Linux MM , Cgroups , LKML , Kernel Team Subject: Re: [PATCH] mm: memcontrol: prevent starvation when writing memory.high Message-ID: References: <20210112163011.127833-1-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 12, 2021 at 10:59:58AM -0800, Shakeel Butt wrote: > On Tue, Jan 12, 2021 at 9:12 AM Johannes Weiner wrote: > > > > 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 workload can keep such a write() looping in reclaim indefinitely. > > > > Is this observed on real workload? Yes. On several production hosts running a particularly aggressive workload, we've observed writers to memory.high getting stuck for minutes while consuming significant amount of CPU. > Any particular reason to remove !reclaimed? It's purpose so far was to allow successful reclaim to continue indefinitely, while restricting no-progress loops to 'nr_retries'. Without the first part, it doesn't really matter whether reclaim is making progress or not: we do a maximum of 'nr_retries' loops until the cgroup size meets the new limit, then exit one way or another.