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=-19.6 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 9C053C433E3 for ; Tue, 28 Jul 2020 15:05:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5E50B206D8 for ; Tue, 28 Jul 2020 15:05:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="r2hUeavO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E50B206D8 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 D77B76B0096; Tue, 28 Jul 2020 11:05:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D4F696B0098; Tue, 28 Jul 2020 11:05:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8C6A6B0099; Tue, 28 Jul 2020 11:05:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id B49CB6B0096 for ; Tue, 28 Jul 2020 11:05:02 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 66D7D1F1A for ; Tue, 28 Jul 2020 15:05:02 +0000 (UTC) X-FDA: 77087807244.27.wood33_5704fff26f6a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 061A43D8E1 for ; Tue, 28 Jul 2020 15:04:55 +0000 (UTC) X-HE-Tag: wood33_5704fff26f6a X-Filterd-Recvd-Size: 4179 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Tue, 28 Jul 2020 15:04:10 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id q7so21511621ljm.1 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=YlVtWbVIHSD5P4gKaoSArNdY796ff7NdOgD9IxsrQBtDlFxLQsJtXbikdKAlphNYOc ThHyKFyyPxtyA/Qj7cUW4Bj5P8RD00jvolqWdyZrN0/X2tCBzFvffCa/91H/M+uT+D/3 aajVfTCuE0McAARZXwC+x7N+JzeQQz9gB12SE+mYMQ9PWqun/ZhlsUeKdGYWhPpUXR6V 6uBcscbFqshL+X/dKigJ1af57Q5QifPShxgKLoSZiClIrZlhqlcNEMCNwHKbXQDK9IHC GIP9yxucTj7HZ/FeG5IU9SV6R3QYsZjcSBttRrUuOL1WrEKj4heMz9A8HUuyzwcCr4Cb 4p4w== X-Gm-Message-State: AOAM5329l7/3j0tdM+ch4ytZDqmyAwswr0MYenIUSAt3BtNmHqrITCYK qeWCeqPnEWquTo+79JaveOOmP4DzUflDpWvNr17M6g== X-Google-Smtp-Source: ABdhPJyBtXIozdbRd6lEJqYK3D9Y3Dhz5EcMC+1cVuW0HGWZuwxdBZ1H2dci/1QsDlmowJpXZTB1/6V9w3F9GuQ7V0E= 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" X-Rspamd-Queue-Id: 061A43D8E1 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000908, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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