From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934077AbeBURSm (ORCPT ); Wed, 21 Feb 2018 12:18:42 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:39661 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934022AbeBURSi (ORCPT ); Wed, 21 Feb 2018 12:18:38 -0500 X-Google-Smtp-Source: AH8x2278UItl2+2pBKZps+Gja/IXK8YbiVuRWKj0oCSjylALqKeV/IjclosaccqZ4YD5ZzDpNVps67ojeiCQZtWaT3M= MIME-Version: 1.0 In-Reply-To: References: <20180221030101.221206-1-shakeelb@google.com> From: Shakeel Butt Date: Wed, 21 Feb 2018 09:18:35 -0800 Message-ID: Subject: Re: [PATCH v2 0/3] Directed kmem charging To: Christopher Lameter Cc: 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Another way is by adding a field 'remote_memcg_to_charge' in task_struct and set it before the allocation and in memcontrol.c, first check if current->remote_memcg_to_charge is set otherwise use the memcg of current. Also if we provide a wrapper to do that for the user, there will be a lot less plumbing. Please let me know if you prefer this approach. > 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 charging of the memory works on a per page level but the allocation > occur from the same page for multiple tasks that may be running on a > system. So how relevant is this for other small objects? > > Seems that if you do a large amount of allocations for the same purpose > your chance of accounting it to the right memcg increases. But this is a > game of chance. > > > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: MIME-Version: 1.0 In-Reply-To: References: <20180221030101.221206-1-shakeelb@google.com> From: Shakeel Butt Date: Wed, 21 Feb 2018 09:18:35 -0800 Message-ID: Subject: Re: [PATCH v2 0/3] Directed kmem charging To: Christopher Lameter Cc: 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 Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org List-ID: 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? Another way is by adding a field 'remote_memcg_to_charge' in task_struct and set it before the allocation and in memcontrol.c, first check if current->remote_memcg_to_charge is set otherwise use the memcg of current. Also if we provide a wrapper to do that for the user, there will be a lot less plumbing. Please let me know if you prefer this approach. > 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 charging of the memory works on a per page level but the allocation > occur from the same page for multiple tasks that may be running on a > system. So how relevant is this for other small objects? > > Seems that if you do a large amount of allocations for the same purpose > your chance of accounting it to the right memcg increases. But this is a > game of chance. > > > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org