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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no 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 B2E65C38A2A for ; Thu, 7 May 2020 17:00:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6A72D2075E for ; Thu, 7 May 2020 17:00:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ibg8qmwW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A72D2075E 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 1B9B7900003; Thu, 7 May 2020 13:00:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 16A2E900002; Thu, 7 May 2020 13:00:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 08044900003; Thu, 7 May 2020 13:00:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0156.hostedemail.com [216.40.44.156]) by kanga.kvack.org (Postfix) with ESMTP id E22DC900002 for ; Thu, 7 May 2020 13:00:20 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9F454D214 for ; Thu, 7 May 2020 17:00:20 +0000 (UTC) X-FDA: 76790536200.01.shoe77_775e8e08f8349 X-HE-Tag: shoe77_775e8e08f8349 X-Filterd-Recvd-Size: 4761 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Thu, 7 May 2020 17:00:20 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id h4so7103786ljg.12 for ; Thu, 07 May 2020 10:00:20 -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=9a51Q0KJvE3zrPblIKzTSl+tjTR3Bde3DH99HzeKLKI=; b=ibg8qmwWjVbS3FUiaxBOHr54QL17/uXAfjcKOSAWUMg75VnfQ93AsgVqCEi9PMtWa9 HLbY16J7t69k2RWxnYhd/nFAHBX8h3Z1/xTqVnT0oYVo74D17A5Y3MTeNlGz7fBMpBG+ gIkD5dglHn0fGdlGpiGoATeuiRXrUnkhRv3NyDPc1iSW2Qf4f/L7pnSVxV7/3Jf6IesD QsrAE1xP8S7h0EEY6/UjSupjkRjY7AKKm3ZQRAphuMi58y8g3fwNHfqtC76KvN2c5JHo J8kqfHofQwpOmg+u3p8lOMam4gk5lYN/2zzv/jGpP+lwgauKVKvj70nyhy4XNmrlLN6i QWAQ== 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=9a51Q0KJvE3zrPblIKzTSl+tjTR3Bde3DH99HzeKLKI=; b=T+PXVlNc1n9CkaGwo8nFmeWfDLZDzMaT2+f8k6+q6SHUlQkgQVyo9u8r6NT5RFGRdB YRlHWowPbdJcYjlvf7XK/n7ReKn3BaAPtFQwOxJcwIYNTug8Jkzc1iRBzlNWx50ZKJLJ Eln2CEjlqyagR7zH61+YDT2sxQI9U2DS2SpqD0u/t3UUnTBpNtI8v8sUTVFffkPU+ejj zi2si//N/cD8OxGbCJP8WiCGNUuaHMXg7NM2BjwtpQXMHJL9MI3wLFCHY6aJLd4n9SEM AQ9inU+ax7eAHKolrc6Fpwmm6mbzQ1DY6S4WE/I86u1yAsjgUxlFyoW/asrJEDFxPNkP 2XBQ== X-Gm-Message-State: AGi0PuZCq3GwgfGlj/XHS5XL7x0bxEzcyBizOn1MzBp9+XDYe5H6HHMC SkGZVdNMBbDmWKJpWdQWq9mkYceLRlA+ez9ndYjUAg== X-Google-Smtp-Source: APiQypIyhbO51v7FfjXwxImM/+MjAA3HzPk6zunC+xStgsr9vkliLLFc7Iea0dnB3vM4lCl1ShWZ4lFbSgpYKbYdzdE= X-Received: by 2002:a2e:9713:: with SMTP id r19mr9127689lji.89.1588870818402; Thu, 07 May 2020 10:00:18 -0700 (PDT) MIME-Version: 1.0 References: <20200507163301.229070-1-shakeelb@google.com> <20200507164653.GM6345@dhcp22.suse.cz> In-Reply-To: <20200507164653.GM6345@dhcp22.suse.cz> From: Shakeel Butt Date: Thu, 7 May 2020 10:00:07 -0700 Message-ID: Subject: Re: [PATCH] memcg: effective memory.high reclaim for remote charging To: Michal Hocko Cc: Johannes Weiner , Roman Gushchin , Greg Thelen , Andrew Morton , Linux MM , Cgroups , LKML Content-Type: text/plain; charset="UTF-8" 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 Thu, May 7, 2020 at 9:47 AM Michal Hocko wrote: > > On Thu 07-05-20 09:33:01, Shakeel Butt wrote: > [...] > > @@ -2600,8 +2596,23 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, > > schedule_work(&memcg->high_work); > > break; > > } > > - current->memcg_nr_pages_over_high += batch; > > - set_notify_resume(current); > > + > > + if (gfpflags_allow_blocking(gfp_mask)) > > + reclaim_over_high(memcg, gfp_mask, batch); > > + > > + if (page_counter_read(&memcg->memory) <= > > + READ_ONCE(memcg->high)) > > + break; > > I am half way to a long weekend so bear with me. Shouldn't this be continue? The > parent memcg might be still in excess even the child got reclaimed, > right? > The reclaim_high() actually already does this walk up to the root and reclaim from ones who are still over their high limit. Though having 'continue' here is correct too. > > + /* > > + * The above reclaim might not be able to do much. Punt > > + * the high reclaim to return to userland if the current > > + * task shares the hierarchy. > > + */ > > + if (current->mm && mm_match_cgroup(current->mm, memcg)) { > > + current->memcg_nr_pages_over_high += batch; > > + set_notify_resume(current); > > + } else > > + schedule_work(&memcg->high_work); > > break; > > } > > } while ((memcg = parent_mem_cgroup(memcg))); > > -- > > 2.26.2.526.g744177e7f7-goog > > > > -- > Michal Hocko > SUSE Labs