Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1017148imu; Fri, 11 Jan 2019 13:21:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN5O4s6/XGHfhPKWwholsqhTOMYrSisaP6JSLeOGNaNHecUz/Quxf5strvXHYyjrP8EyYjJe X-Received: by 2002:a63:a112:: with SMTP id b18mr14924443pgf.440.1547241709844; Fri, 11 Jan 2019 13:21:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547241709; cv=none; d=google.com; s=arc-20160816; b=iHdIx99ikhqzwn93fMRtLyQPmKlKDmeGKbIvb7qdx49yQ1oIQuFsVIZUFAsPwX69fC vG1OKsWoqjTVwjQ+z6rq/m154xsS3xNXtN3XUpQsG6cRK0DN8sLg7prHxRXKpAK+XMk9 39z7ny1h2JEQYcElblkNtl0+D+l9ReW+ZmmLcmpYrlabEThTwQgHZBr2hRgoeH1iQQDo dRj6DrK9By/ViGpCBZjwQyec5NGPR1a0Hf3ncnuJYg2M4t2dPKsSvQXfrJYOEFVzPDMB SQ1Xv2a5TmOjC6bYBhMOSuemOlgcw/U5KHMRZjrR8oo471vX2/i0aWquA1cI8p+LJBJR G5Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=njp5vf4IquyG7FjzRfZTdEcdSKU/h4oc8yA5MyBHjJU=; b=YxlZECdTQsjRc2nh4D3RIP88A/xVrSgsvY+kEF6ZClhV+fmRskhINBoaJYg/zGkFuk 6x3GI5lhDWTjEohCVFomLRYxT3l9pRz8KHNcPbt3yjjffYMRATHbzlwHTWA7HS2qGWBA QMjd+IIiWPVXWXeJfDp52brhAZTSPyNgOLJYB3NKnSGcE2NHLiJj1kMfXcn9YOgBHFZg eSUDQG7ni4GbJyVvqq8T16fpkA7SJSv+dqsPPSCK9iHty4OGSmskxXZ5r5i/UoyYNZph k9mBP5Gr3E0DYzjDbbLbgC1Vc+DJOV7klNPv1OU9cyFNELqNl8pKimF/nwjfapbTkheL nN/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b="1Cc/BB7Z"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o28si76678862pgm.238.2019.01.11.13.21.34; Fri, 11 Jan 2019 13:21:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b="1Cc/BB7Z"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726708AbfAKU7w (ORCPT + 99 others); Fri, 11 Jan 2019 15:59:52 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:35309 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726635AbfAKU7v (ORCPT ); Fri, 11 Jan 2019 15:59:51 -0500 Received: by mail-yw1-f65.google.com with SMTP id h32so6361586ywk.2 for ; Fri, 11 Jan 2019 12:59:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=njp5vf4IquyG7FjzRfZTdEcdSKU/h4oc8yA5MyBHjJU=; b=1Cc/BB7ZTijZh8NgENDs+quiQLlsEB/RwXggD4otkGLiHnJNDrVCCl3zYsoaDzvVJE +kqROyhrKEReL7V4qE3RIHvcbnPgA6qWFBficRDtwx0fqbeqaiup3nZaeKzTjyXnV9+f zXo7Z8+ujHOnljGOxOAF//foOnPw0C55Qjts3m/7lSZlQY9KLyljSuWiooQ1yz9rkx6V kwMm8VfiThxj6ETEQ9t+DN5IbEjM6PN8mO1dUWmbP7u+yH5uUIs7hMPbljfI8faq/OjP 3oXOXWLghhFr762GNmV/3a812f5OtS2SwHYLKOgJtMHSgBVae8e3Yt8kt2erYBCxfvKx +i9Q== 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=njp5vf4IquyG7FjzRfZTdEcdSKU/h4oc8yA5MyBHjJU=; b=rnT1jgOJURpBwvipzWrzyWuqQNEqhRgK5/Mf1UzZchSNuuSA7gpoyGpiZ3dsoz7Jwa g6mLxbBMhaB3k8AZQHGHR2CboJwKRAK7nSJWufieBuPbrNOuaA3I7KkXwlIa7LZEmiyR Hx4CP6WDMl68E2tnr4oTOVXfSHPwA+/LVFdCx3kRtrD++jlgA16F5646uv3MhY2eksCx Ar0bpfuT3XFzVqAC6QN9uTCNpzqLmM0kGWvkRwOpSZn8gOfVBSAQwLd7ezDF/J3XwyX/ HxgcQXvexF6G7K1a68dZm/dfwtNRRmbQIQqIjaA1Q50+0WpfeC22luFclhVWPnWzOHyq QlbQ== X-Gm-Message-State: AJcUukfNmqmljKrmh3/OAFGHa+BItTPFU5BQoiDVhQdL3Pa1S/Y8yCQc fKHUv1e3y3Y4nlbpT2fNQke29g== X-Received: by 2002:a81:7c04:: with SMTP id x4mr15619354ywc.264.1547240389726; Fri, 11 Jan 2019 12:59:49 -0800 (PST) Received: from localhost ([2620:10d:c091:200::7:107e]) by smtp.gmail.com with ESMTPSA id w2sm61210501ywl.10.2019.01.11.12.59.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jan 2019 12:59:48 -0800 (PST) Date: Fri, 11 Jan 2019 15:59:48 -0500 From: Johannes Weiner To: Shakeel Butt Cc: Michal Hocko , Andrew Morton , Vladimir Davydov , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] memcg: schedule high reclaim for remote memcgs on high_work Message-ID: <20190111205948.GA4591@cmpxchg.org> References: <20190110174432.82064-1-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190110174432.82064-1-shakeelb@google.com> User-Agent: Mutt/1.11.2 (2019-01-07) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Shakeel, On Thu, Jan 10, 2019 at 09:44:32AM -0800, Shakeel Butt wrote: > If a memcg is over high limit, memory reclaim is scheduled to run on > return-to-userland. However it is assumed that the memcg is the current > process's memcg. With remote memcg charging for kmem or swapping in a > page charged to remote memcg, current process can trigger reclaim on > remote memcg. So, schduling reclaim on return-to-userland for remote > memcgs will ignore the high reclaim altogether. So, record the memcg > needing high reclaim and trigger high reclaim for that memcg on > return-to-userland. However if the memcg is already recorded for high > reclaim and the recorded memcg is not the descendant of the the memcg > needing high reclaim, punt the high reclaim to the work queue. The idea behind remote charging is that the thread allocating the memory is not responsible for that memory, but a different cgroup is. Why would the same thread then have to work off any high excess this could produce in that unrelated group? Say you have a inotify/dnotify listener that is restricted in its memory use - now everybody sending notification events from outside that listener's group would get throttled on a cgroup over which it has no control. That sounds like a recipe for priority inversions. It seems to me we should only do reclaim-on-return when current is in the ill-behaved cgroup, and punt everything else - interrupts and remote charges - to the workqueue.