Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp369528ybg; Tue, 28 Jul 2020 08:05:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGjNiCbhW2kzAoON6c7Z8mg6l9DWutGhDt5kNS61iYW0XH32jOKfXg+/baV5Ey0zrsgMHP X-Received: by 2002:a05:6402:1507:: with SMTP id f7mr27549762edw.37.1595948756955; Tue, 28 Jul 2020 08:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595948756; cv=none; d=google.com; s=arc-20160816; b=xZD5h4Bce6FI38qR/4Ex25eY9Xfil+oKy2DnP9bYlEN+tqXZa7lYvdCZxc1WxnQfRG OBZVUWQ6YHA460NYvy3tJWYQlNDM0KNqzfFSA1NqbZM+fNXvwPv7sBJbk1muwzOloiky LpFte0w5JrU1qOSPJdSFwlRn8OcoFBiJA9IBTexEUaar2m+IkbKCDI3z1L2NUgTKwD7d +66fny4cgaCmuDr3TpkHlLWcaEje1o3yglJdHyS6lkU0TxFTO0QllumNO7HQqsGgDGRT t/yaDT6dsjN/vuSZ8arh0l4t+qaP1wDUqR9f+bu2+qXXump+RDpf3MsGuW1Ull4ogYQP 8o0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=y/P1RjJpCb35GTdXwmZama92miIfq20CiqjQcC8AgAQ=; b=isKtHiqipjK2/S3deFMbs0ooyUL6Scr9m8XedzbhuctEl+NYTDDxOjCDmJxnYt+Kdj ZtCRF390y40LehW9AlI0RiG1aXKTKibTSd3+amWRk8e4rkHtqWMnl6EHN3/1/Z7pkMYT 76NNlUCTFu9SjTeNddHw5+9Tv/hASEz8wKt+ul9wKzmhMSMug7ZhiNEGJDvRoK8r/ARY zcWfFWtZgUNAZ9mFs2u6hFNHTC0slW8NCCDO9GQww/PSLPPTtuJ75YujZXsunq6BnjO/ ZuY2W9Fgj9IIt/reVIxh75IuwOmv9knCvOJKwclBcKhvY13zfY1FZvC3DxP9Hj4fVY2l aUkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=r2hUeavO; 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 y21si8130254edm.256.2020.07.28.08.05.28; Tue, 28 Jul 2020 08:05:56 -0700 (PDT) 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=r2hUeavO; 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 S1730573AbgG1PEL (ORCPT + 99 others); Tue, 28 Jul 2020 11:04:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730521AbgG1PEL (ORCPT ); Tue, 28 Jul 2020 11:04:11 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91BB9C0619D2 for ; Tue, 28 Jul 2020 08:04:10 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id r19so21462067ljn.12 for ; Tue, 28 Jul 2020 08:04:10 -0700 (PDT) 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; bh=y/P1RjJpCb35GTdXwmZama92miIfq20CiqjQcC8AgAQ=; b=r2hUeavOspQPDYUPCBYkcJ2t+SMHCVWUjhVCsn95Ke4mIVcywTVe3IycEi48ReFcwU kcAOO4zPa99rNHCsHrWLtD4PXhyPCUyPjdEP7NYt3nvm6ux90bPxF1FWXFiyakhvkdkO VnOh0VAy/vHFlRk7yxNZKDWh+hlim9Bu5/Ou/OLzZclgir2QQrrtAFl89Rm8azwsMtvy bjqK7LiMwhx43GT7gM6KUsyOcNHjLhKYiMBjFxnZga7trt3rZuSkz4MImI29UhrVr7tV BsLP4fsDZpp6Mz+5Zk0E9362Kt408Wx7KJyjNDFq8OmfFzxE+bdGWKGRvhP7xee39zg1 a6Kg== 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; bh=y/P1RjJpCb35GTdXwmZama92miIfq20CiqjQcC8AgAQ=; b=mLTul3VHNwQrVk7MhKXZIFfDr0uKYNMpYZn+pv/X2DV+Blu8PTolwiqu3NK9qEG4GO 3fZ0ihDc4lzRoriSWSg+6V0kuhLX/BAnLL4yF/qRKTEso1lnMaHsZymKAuehyRaBLRt4 x12YnfhA82eBZAHEqZKUu5DuMDWxzTZV6DUkrLo6f8s9EaTkiQYIzhwUP+e3KAERVzuE 9y2YH8nWis4YhSExrnM2BnVa6GuSvWh94/enYGNYoeWPJPlqtqYyKcqGBIAywiD3I3CN 3CRxGIX24Hyh0YnhJPKOT2MRx2PnwlHRrHsTWIALMWGGGoVnQqOfL8X6/i403BMDVLMe Ofww== X-Gm-Message-State: AOAM530pNHtSPU2sTSFQXQYAzbGUp6zR71LNkhOYvv9NfntsPGPXliZc MHmqTo/15mbNJXwdkSRgEfuzc5VnixtuF6704KnLyw== X-Received: by 2002:a2e:9996:: with SMTP id w22mr13868230lji.446.1595948648596; Tue, 28 Jul 2020 08:04:08 -0700 (PDT) MIME-Version: 1.0 References: <20200728135210.379885-2-hannes@cmpxchg.org> In-Reply-To: <20200728135210.379885-2-hannes@cmpxchg.org> From: Shakeel Butt Date: Tue, 28 Jul 2020 08:03:56 -0700 Message-ID: Subject: Re: [PATCH] mm: memcontrol: don't count limit-setting reclaim as memory pressure To: Johannes Weiner Cc: Andrew Morton , Michal Hocko , Roman Gushchin , Linux MM , Cgroups , LKML , Kernel Team Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 28, 2020 at 6:53 AM Johannes Weiner wrote: > > When an outside process lowers one of the memory limits of a cgroup > (or uses the force_empty knob in cgroup1), direct reclaim is performed > in the context of the write(), in order to directly enforce the new > limit and have it being met by the time the write() returns. > > Currently, this reclaim activity is accounted as memory pressure in > the cgroup that the writer(!) belongs to. This is unexpected. Indeed this is unexpected. > It > specifically causes problems for senpai > (https://github.com/facebookincubator/senpai), which is an agent that > routinely adjusts the memory limits and performs associated reclaim > work in tens or even hundreds of cgroups running on the host. The > cgroup that senpai is running in itself will report elevated levels of > memory pressure, even though it itself is under no memory shortage or > any sort of distress. > > Move the psi annotation from the central cgroup reclaim function to > callsites in the allocation context, and thereby no longer count any > limit-setting reclaim as memory pressure. If the newly set limit > causes the workload inside the cgroup into direct reclaim, that of > course will continue to count as memory pressure. > > Signed-off-by: Johannes Weiner Reviewed-by: Shakeel Butt