Received: by 10.223.185.116 with SMTP id b49csp1940874wrg; Thu, 22 Feb 2018 05:47:33 -0800 (PST) X-Google-Smtp-Source: AH8x2260n5TIQXHaE0h3bdDMnqIf5lhjdWZ4h8M2CcaHkoSvDJyFxx3Ln2c4KZRntFKbTxJZ5E11 X-Received: by 10.101.98.133 with SMTP id f5mr5673512pgv.357.1519307253269; Thu, 22 Feb 2018 05:47:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519307253; cv=none; d=google.com; s=arc-20160816; b=Vrmepqhwm+nGhC3WprVAzxT9eNsvww1BjbtSM5qGANSx2AOR+IjOzOjgyq6T4C2arp 7jKCcCRHbAr8ge9+q1La62s57sg47IjcW4f2B1qE59kP4URPicqYHQ9gsPaFGdhK7FEU QT5/TJZNNIRTQbadKMvEBFUFr4fmMc882486UdWTMDycP45gzEEV7idT5JsWY3E8mDba /gO6bxyU01dU+V28wLY601QxoRAovxR3T/utTA98a5RNvtk+gdiujrIYTyxInzJngjsE DmmUxQRKveXzGouK+Vv1fczKWoRnPYduvFrVaOL5YY7ehGTVV19AejtAr6srGQlaiYO4 lgxg== 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=OtS1Vu+Joi06zrRhKNS2MH7AyU99cuqHmLuzW5PIHe8=; b=rP3O3kbUYs2qLC3+PVgUXuUqXRLueWsiGCMjH6CWgzHwmhfKzyAJ70P5lPt9avKU1A wEh3vivzcQ4yRM+ec2heavwJ9wqhRPSphIguzdArobXG+6NpKzlsBBjr1aQ3MWlUem0+ DqJhsEGWOVSMpe1kOTbuenksc7upIDvYcLVHfEwYhwcfOThMG2TNnR3LsuRlj5hvHsPo pRpV1dDj72HLmwkdPgtmjLm6riUfAsavZmvQRxJQkrPFd3TxE5vZc4bg00IAwcsAxIQy Cadpp93jcQQVbazZaNZUlBg8iVwl8sFKLEvbJ4KAi+c7p++uCuMFNsOE0lOSg3sLMOWC /sWw== 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 f3-v6si79034plf.289.2018.02.22.05.47.19; Thu, 22 Feb 2018 05:47:33 -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 S932594AbeBVNqI (ORCPT + 99 others); Thu, 22 Feb 2018 08:46:08 -0500 Received: from mx2.suse.de ([195.135.220.15]:49022 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932414AbeBVNqF (ORCPT ); Thu, 22 Feb 2018 08:46:05 -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 31F5FAC64; Thu, 22 Feb 2018 13:46:02 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 1AAAD1E04D6; Thu, 22 Feb 2018 14:46:00 +0100 (CET) Date: Thu, 22 Feb 2018 14:46:00 +0100 From: Jan Kara To: Andrew Morton Cc: Shakeel Butt , Christopher Lameter , Jan Kara , Amir Goldstein , Pekka Enberg , David Rientjes , Joonsoo Kim , 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: <20180222134600.5tvizxkroc4oisrd@quack2.suse.cz> References: <20180221030101.221206-1-shakeelb@google.com> <20180221125426.464f894d29a0b6e525b2e3be@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180221125426.464f894d29a0b6e525b2e3be@linux-foundation.org> 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 12:54:26, Andrew Morton wrote: > On Wed, 21 Feb 2018 09:18:35 -0800 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? > > > > 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. > > That would be a lot simpler. Passing function arguments via > task_struct is a bit dirty but is sometimes sooo effective. You > should've seen how much mess task_struct.journal_info avoided! And > reclaim_state. Agreed, although from time to time people try to be too creative e.g. with journal_info and surprising bugs come out of that :). > And one always wonders whether we should do a local save/restore before > modifying the task_struct field, so it nests. > > What do others think? Sounds nice to me. > Maybe we can rename task_struct.reclaim_state to `struct task_mm_state > *task_mm_state", add remote_memcg_to_charge to struct task_mm_state and > avoid bloating the task_struct? Yeah, even better, but then we really need to make sure these things stack properly. Honza -- Jan Kara SUSE Labs, CR