Received: by 10.223.185.116 with SMTP id b49csp1947606wrg; Thu, 22 Feb 2018 05:54:46 -0800 (PST) X-Google-Smtp-Source: AH8x224D8DTAIZb1wXGrAbVt/yqhmvdfgLShJxIzW8EHub+4T6F4/VYHpfJtE2nmQWelo3XjTWz8 X-Received: by 10.101.76.71 with SMTP id l7mr507294pgr.192.1519307686082; Thu, 22 Feb 2018 05:54:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519307686; cv=none; d=google.com; s=arc-20160816; b=wy8ggo3tFzgRfa3/KtntPF21Rpvu5Oj8QlJvD3XtpmrLDEQwdo0uEO101s68nJQHrN i8Pj+i6JTi/UP4YEobwIywODJ8CEjEI+2JY1usYjDA1eRo4IYVPg/aaFPEgSDygd2G1l h1fAobemGY01ZzGmgLkJcRwOFVABqLqHmXGRn5h8aIMEm5vDktJwQkweCYGIPVXjVi2J Y6jXiU0Nfav0/CZrmyl95qXc33/sbDZRz6qMngBhqfoWEuSB7JxZ8/F4KITVDXTMoWbn yk+dHGo4VQbtnL4BPPqTXbJ9HB44YqEBiB4SOy8jwqBpJmelL8xoTSkMKks/D/J+J5ix Z4HA== 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:arc-authentication-results; bh=jhFo9uFfb5nVIXE3fNo8PN8cTqCUMAC1djGq417HII8=; b=lDVxmRVQwyzbDkTTliT9W9Fr0pv7AIAAiPtoXa52TAeNin2vU8r+sgkv/6ul8R2764 wEK+ETKlYoHqqZiTQhestR6TJ6FFO0MIwK1vrjEZa+w7dtuzZvZchRvLVCLs3AjCWQX9 iJmLnAHUk+FjPBMYASwQkScHqIs0bLwU7U9mJQhbiHQ0hJ/Ux54oW14tRaVFEP/eQF8T 6f2QATNfOxAoFvCsw//XBwIGbnf469QO4ZxT0qdMN7Ok8RzQqU0ebqktlb0Y5QX5MtAF 8xMSquRuUX0KcmxJspVkTIrb6iToF1YfWYapEqufbB4kkfUYXjyGpXKYQQ1yNo3Rn8tf sV3Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si61641pgv.317.2018.02.22.05.54.31; Thu, 22 Feb 2018 05:54:46 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932648AbeBVNxv (ORCPT + 99 others); Thu, 22 Feb 2018 08:53:51 -0500 Received: from mx2.suse.de ([195.135.220.15]:49978 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753840AbeBVNxu (ORCPT ); Thu, 22 Feb 2018 08:53:50 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 050BAAE38; Thu, 22 Feb 2018 13:53:47 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id DF51A1E04D6; Thu, 22 Feb 2018 14:53:45 +0100 (CET) Date: Thu, 22 Feb 2018 14:53:45 +0100 From: Jan Kara To: Christopher Lameter Cc: Shakeel Butt , Jan Kara , Amir Goldstein , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Greg Thelen , Johannes Weiner , Michal Hocko , Vladimir Davydov , Mel Gorman , Vlastimil Babka , linux-fsdevel , Linux MM , Cgroups , LKML Subject: Re: [PATCH v2 0/3] Directed kmem charging Message-ID: <20180222135345.epm6e34cvxzaxn74@quack2.suse.cz> References: <20180221030101.221206-1-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 21-02-18 11:57:47, Christopher Lameter wrote: > On Wed, 21 Feb 2018, Shakeel Butt wrote: > > > On Wed, Feb 21, 2018 at 8:09 AM, Christopher Lameter wrote: > > > Another way to solve this is to switch the user context right? > > > > > > Isnt it possible to avoid these patches if do the allocation in another > > > task context instead? > > > > > > > Sorry, can you please explain what you mean by 'switch the user > > context'. Is there any example in kernel which does something similar? > > See include/linux/task_work.h. One use case is in mntput_no_expire() in > linux/fs/namespace.c > > > > Are there really any other use cases beyond fsnotify? > > > > > > > Another use case I have in mind and plan to upstream is to bind a > > filesystem mount with a memcg. So, all the file pages (or anon pages > > for shmem) and kmem (like inodes and dentry) will be charged to that > > memcg. > > The mount logic already uses task_work.h. That may be the approach to > expand there. I don't see how task work can be used here. Firstly I don't know of a case where task work would be used for something else than the current task - and that is substantial because otherwise you have to deal with lots of problems like races with task exit, when work gets executed (normally it gets executed once task exits to userspace) etc. Or do you mean that you'd queue task work for current task and then somehow magically switch memcg there? In that case this magic switching isn't clear to me... Honza -- Jan Kara SUSE Labs, CR