Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1086198imu; Fri, 11 Jan 2019 14:56:04 -0800 (PST) X-Google-Smtp-Source: ALg8bN5m1pyozJ+8Oud5FjgbZOUqA9KykonzwO1tm9SMKqi1riAwZlE7ae79WTDMQU5NQHuJNnOF X-Received: by 2002:aa7:824f:: with SMTP id e15mr16006052pfn.192.1547247364253; Fri, 11 Jan 2019 14:56:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547247364; cv=none; d=google.com; s=arc-20160816; b=is3cGFRB7XGHgod5D43sjbadc9fXWdz6i/h98MZBFuIbvMKc00DRo8MK8xyiMnwRuN i0LS1/wMZ4Lwg0NFoZpaxDlYsJTMEXy3HdcCQB5MdfhapUm6fm5ppo5Ui3aPKsXwXLuJ +RJuYM0cmPBOBFg0crNjiNiBE2PNdQ9IFdDxosqyxoZZyD91nbPDWbYybS8CdmyngpVN jdMzmuGnkwa8dZ1zq9OkYrX6XNeUE+Q+Cl71oQZZDeDDD7g1lhhyi404pl234EHqkok0 qItxa8/fRZbU0yaUAJkGDNtHQVAilsVEfFvYbdWjR9n+bZaW+0Y/j0/RI2Qj7gb+hqG1 7Eag== 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=zNLkCKY+SwAC6X03tE2DXpF/Ov1i3/WPtlft+zOut7Q=; b=SUO9hmNkO6uwRgqoliS3/AgUO+9yNRiwQayhOsDk5QfhaXnZIjpdaVgeJHuMdDjYkm DQKMcpSDP0XwMLNeUecfDB3JcE0bPYtnpbAtTG6Uq6BjkAGQ9Fy1fEu+4LbdSw5kZca6 u3N2Hn4Gm2j0vyzTIIplfGoTaCjLCzd7p4p96l7yfHRlYNd7ZbgpV4qxW+vxcGSkhZWD VsGBcjF+z4Y0YeZb2OT/Yq1v/LYShV9nbVSXrzkwiwizlFxWFQAEPSB/W4v4udoVSZ1r wzOCEB3Xa94sdQKwaUvgdL9uRyFvC6kKyJganCMOMQfcCIOiEi27GPC9wJMOkD32zh1P FGIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="FEpu/iiL"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1si74208638pgj.34.2019.01.11.14.55.48; Fri, 11 Jan 2019 14:56:04 -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=@google.com header.s=20161025 header.b="FEpu/iiL"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726278AbfAKWyp (ORCPT + 99 others); Fri, 11 Jan 2019 17:54:45 -0500 Received: from mail-yb1-f194.google.com ([209.85.219.194]:42295 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725829AbfAKWyo (ORCPT ); Fri, 11 Jan 2019 17:54:44 -0500 Received: by mail-yb1-f194.google.com with SMTP id q145so6464460ybq.9 for ; Fri, 11 Jan 2019 14:54:44 -0800 (PST) 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=zNLkCKY+SwAC6X03tE2DXpF/Ov1i3/WPtlft+zOut7Q=; b=FEpu/iiLCbxOefMnzM+e29eZKUax+WKTJ9cjl7jOddbTZebY2/SostcNctqDa4Dx1d 6PVGqwf/eCG5vnokQvGr4clowLfbg9xLUZSMTuLRfbpPvCHlaY+r0yVqlebFpQBruaV6 lpGG8ufiLq04g9gN1mr9xx3dGHW2oYOasQKFdaUk5gry9EnW89oel9439Cf4X2wo7fRV 6SjB4/q2uvmLUY6xdEowY1v/MCl4iduT4Ws1P/pzxqenWqc/QYNbjXJpSLwcZsvrULgI gCwPzn2kRQKyMt4LWg8uPyulInvJ63418sXt8UOrwObgJNQlkxH8xLhrQ8iD4eGPD2cb wjSA== 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=zNLkCKY+SwAC6X03tE2DXpF/Ov1i3/WPtlft+zOut7Q=; b=YOxn/Hzgbzy6yl7g5lDpUDdxI0r3plNbpO60ZxbOP1hSY89LG9sf5yVAePhGuxCytu ZP6liC1UiPvh9gd1+9WkrKEeldsBxBKBFASq1dJMzCIojVZhd9MynuPPs57BqI4EzVtI xLoUqgvE8TjfiLnkLP5lEOFAGr+UP4obdn3Qkr9Bx5OazdLUS8AMuZr8DUzafDZe3pwC eV58corTkScHG9nqu53+sQ+vtlfpg7t7oODu1PMvJ6tEgdbNZKW90+bWb/cA/8CZeFu9 oi+YrfSktMB6oHLlCW7lNOXuMWnlCkO/d3L2UxV2imnrbwTgjGSBl9iGoWkMJknFm1Cu PUBQ== X-Gm-Message-State: AJcUukcCY0HEIqRZgpG0WSCL7+DYJgzLfjslIT1quAkQZPdsJG/EfRwO QJe7hp76avC0iztNQbaRGewQqSW0hZkAcW1OvHMNog== X-Received: by 2002:a25:2743:: with SMTP id n64mr959711ybn.164.1547247283381; Fri, 11 Jan 2019 14:54:43 -0800 (PST) MIME-Version: 1.0 References: <20190110174432.82064-1-shakeelb@google.com> <20190111205948.GA4591@cmpxchg.org> In-Reply-To: <20190111205948.GA4591@cmpxchg.org> From: Shakeel Butt Date: Fri, 11 Jan 2019 14:54:32 -0800 Message-ID: Subject: Re: [PATCH v3] memcg: schedule high reclaim for remote memcgs on high_work To: Johannes Weiner Cc: Michal Hocko , Andrew Morton , Vladimir Davydov , Cgroups , Linux MM , 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 Hi Johannes, On Fri, Jan 11, 2019 at 12:59 PM Johannes Weiner wrote: > > 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. This is what v1 of this patch was doing but Michal suggested to do what this version is doing. Michal's argument was that the current is already charging and maybe reclaiming a remote memcg then why not do the high excess reclaim as well. Personally I don't have any strong opinion either way. What I actually wanted was to punt this high reclaim to some process in that remote memcg. However I didn't explore much on that direction thinking if that complexity is worth it. Maybe I should at least explore it, so, we can compare the solutions. What do you think? Shakeel