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=-13.6 required=3.0 tests=BAYES_00,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_AGENT_SANE_1 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 B80B9C433DF for ; Tue, 28 Jul 2020 19:44:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6DE66207F5 for ; Tue, 28 Jul 2020 19:44:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chrisdown.name header.i=@chrisdown.name header.b="T9uJ9mFo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DE66207F5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chrisdown.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F09868D001A; Tue, 28 Jul 2020 15:44:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB8E28D0002; Tue, 28 Jul 2020 15:44:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DCF198D001A; Tue, 28 Jul 2020 15:44:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0045.hostedemail.com [216.40.44.45]) by kanga.kvack.org (Postfix) with ESMTP id C8C2D8D0002 for ; Tue, 28 Jul 2020 15:44:50 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 81E2D180AD806 for ; Tue, 28 Jul 2020 19:44:50 +0000 (UTC) X-FDA: 77088512340.26.snake13_0514fcf26f6c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id 531591804B66E for ; Tue, 28 Jul 2020 19:44:50 +0000 (UTC) X-HE-Tag: snake13_0514fcf26f6c X-Filterd-Recvd-Size: 4266 Received: from mail-ej1-f68.google.com (mail-ej1-f68.google.com [209.85.218.68]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Tue, 28 Jul 2020 19:44:49 +0000 (UTC) Received: by mail-ej1-f68.google.com with SMTP id f14so5990054ejb.2 for ; Tue, 28 Jul 2020 12:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=RkoR8SRsEyrF2DTHYAGqExugDiMhFbQnq4qppceRyxQ=; b=T9uJ9mFokE3Rom3E92aAP07PvouUaqSFqQVv02w73ZLda3GVnG9dqeQ8A6++cuDNaG JhR9XROOwvBKmnM22qrgiEQ4q/UEWLMu9MpmZl+5FAbsRjf9z2a4fw5GWPmPvAaQetrb lpIr7cCLzsyFxEF9sP3U7dtZf6wz53vufxdjA= 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:user-agent; bh=RkoR8SRsEyrF2DTHYAGqExugDiMhFbQnq4qppceRyxQ=; b=HVdopjiyoaMPUQYR1RBhxBGGk/aAz7ZIxuo5ME4vx/aO3aixjmD+7eB7wNGovy/ZOV qn62SnoUzaapqXICnt6gmtl8ftTE+hCQTkUw9vCsNiqGnBmb2Y65mxy1k7CcpxdqYJet mv2jPgTxUO6EMpo01AEwg1Hug1xgrRZk60ATggtFp1B3lZfB8em9Pi+A2fFFczbWH+sx SAQYft9HEig8Uoj6pxp4t2a91QK6jdCO+QMzhdfZVn62//VlqQQDfFJIo8tK8irLZYsy DZhQozqJ9JarHL57a2pnGZFzPeJKrm7BPx5+LRDFUQ9JJ/dKCOdkf5zW0n9N6lHL6B/c +3gQ== X-Gm-Message-State: AOAM532BO5mOD+e4096ABNq/yvRkgvOSWD/+sOvbJ85ZopjfHoZ5sxOL 0y76bKDX6vJO/pWfNEP/pc7SYQ== X-Google-Smtp-Source: ABdhPJyy+UbCRh/ek39ITwXBTt5sWdRD3rTd9LGjRFT9wh6vIF12fOXqlhthXA//uTNtq/f+Fm92Og== X-Received: by 2002:a17:906:2851:: with SMTP id s17mr27794849ejc.347.1595965488560; Tue, 28 Jul 2020 12:44:48 -0700 (PDT) Received: from localhost ([2620:10d:c092:180::1:f8d8]) by smtp.gmail.com with ESMTPSA id i5sm9663975ejc.114.2020.07.28.12.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 12:44:47 -0700 (PDT) Date: Tue, 28 Jul 2020 20:44:47 +0100 From: Chris Down To: Johannes Weiner Cc: Andrew Morton , Michal Hocko , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH] mm: memcontrol: don't count limit-setting reclaim as memory pressure Message-ID: <20200728194447.GB196042@chrisdown.name> References: <20200728135210.379885-2-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200728135210.379885-2-hannes@cmpxchg.org> User-Agent: Mutt/1.14.6 (2020-07-11) X-Rspamd-Queue-Id: 531591804B66E X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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: Johannes Weiner writes: >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. 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. Seems totally reasonable, and the patch looks fine too. >Signed-off-by: Johannes Weiner Acked-by: Chris Down