Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp895495ybj; Thu, 7 May 2020 10:02:58 -0700 (PDT) X-Google-Smtp-Source: APiQypKxvEDgw5sjKF45o/7yxXKQP3ZO2YW0DJOR3Emw8TqXnR+KMVDCcEwgSOh7Zu1t3h4usSS/ X-Received: by 2002:a17:906:4c46:: with SMTP id d6mr12759553ejw.257.1588870978502; Thu, 07 May 2020 10:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588870978; cv=none; d=google.com; s=arc-20160816; b=L5jDPjq74lONe/DzzlepnwCWOeG5n0MU5OEVrHSqoL95AT6PbetU7ViLrg9u4KYFdx XQRUNw+1EbbJ630IIiDL3KQ2xGQYXtpK6q0yO+AkzvuYLBBZ1qWN4HTmzhAbq+TI9wDe YOaw8e+LoV0XIiXSUYlHe7TWuIcN2iiv7jcQTMX6aMi4sIq0/pYRheNqcU3jSIsfKvHf BUNgKNtJ/qDRBy0ErImLWjBKLrYPoCMCp2ac8PQiQjnvrsiBKTrGVO1LoQO8TMTpvLbN wuKW/eDqZ7bvuo4My4qOXvL8ZurMHOjt/8LcNpl+IKDeKfy9F2rA8TfpsN3b8hiMQXep Ovtw== 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=9a51Q0KJvE3zrPblIKzTSl+tjTR3Bde3DH99HzeKLKI=; b=QFP4ItBYuhE81wY4zXkoWU/B1Ujw6kDR0GUeZv8F7wAC6TiDt9r2xIOgg3oYOO7Onh XdchLSJBva8PSZCixdAQJamoaBvgEQ+/ohvnx6FRRBQKqnFxs+4/dTF2XIKEX86kZ9U/ fMUiwvWr+72SqAUQpCnjjLh5WSxA80WaJlehBwmBYQ6OEGrxnXECBuNarzMq/wq9Pr47 ykfhlSDRmskoxF9JYNFpGDHtJHqauHIQiwtTm2srPzEGGygRwtRNwPmdvMoemeEVk0OA zqrLNYNvJqcjfDFs+iqWO1S7529l9Gmb9vs9GLOVjzu4wyB3kdTH+gDH3WE4VT6g7BCb m2PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ibg8qmwW; 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 u8si3648952ejx.26.2020.05.07.10.02.32; Thu, 07 May 2020 10:02:58 -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=ibg8qmwW; 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 S1726558AbgEGRAV (ORCPT + 99 others); Thu, 7 May 2020 13:00:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726222AbgEGRAU (ORCPT ); Thu, 7 May 2020 13:00:20 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BBBEC05BD43 for ; Thu, 7 May 2020 10:00:20 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id j3so7096680ljg.8 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=JrDEUiyfx2skROMXVHN8CJqlsol74hnzGIFoByOQ7Aj4YUGtXGghXhDN4Gp070Avs3 wgNoRgHNsj1vVd3LAA0ORCNs+Njo7zp4IqbMAJUU/34lSHSZqdTHTP3wcteC7ulqjkih /tDLh8CzCwkOqNA0/rbfU1YHkeD8VlIkENJbBL+tFdH2rEEc4qhRvp3UI33w3iZTHys6 m14jHLIy2//w4bsG1L908Wmm+S6sGMjx+Me+aszdm2agluHnU+Te4iz4qmLHYbgZgYW+ F7ZLmy6N6snGGTk6q2KP8APGCAg2ySMNIWGiLlnMJRg3akdwft3t5nQkhGiNZo2+QO99 qFrQ== X-Gm-Message-State: AGi0PuYxXjx39wsMaCfRQgQkiKI7MMGXmVE1FlKiSZLvWqnZ7vBZMJJi aNWIN79b2mJB/Wc8JjwCGsNYVNueYfKy4YNnQlo1Pw== 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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