Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2118991ybm; Thu, 23 May 2019 11:40:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKPh2oc/zgnGu5H21SYUwpxzSBSu96K5+xB3nBZDY/jKkw5woqFSA3TsCqzM2wx02PoVTs X-Received: by 2002:a17:90a:8089:: with SMTP id c9mr3237432pjn.68.1558636806156; Thu, 23 May 2019 11:40:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558636806; cv=none; d=google.com; s=arc-20160816; b=GMm99y7UkgiToUIVLsPN3zaRYkXny3XEMvFfYnPfK+wlCsFQFnipTEef6iUl+hCV5b gJusYs/i+GFPahmSKmABJ+XyjQyC28Y9l5suM6P+3oRXod+36oE6B7NVkfIDY4ntFx6w 7Eca8lwFfNqbONA3pPkq1tB6ePkn82ZCm7HGFxVPnkdwn69ysvF3FhMDBWWxtgWdMZRv ZWSj1q7/bljtGMnB72oQWo3S7V1bnWWsTIUPrbJ4kaz6pO66xMh1qjOFDoWETEoJzjtf zL04+4XxoW2h14hKRYMi76vvq+yq3UO1dT5KUtGBhJJpxiHeTtJPnQc4X0qImIO74c3z ZIjg== 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=mcI32xfmsEoQcujsoa3t+R8aU7MbjBpf8zoUWNfm5Mc=; b=Jqpy2qoD1X0uzyEA4wsNqTUKTa5muiWFTFruRP5tFSJiPbM0/OTdrOl0HzRALoMDkb /JuTNjFDN/SWb91YDDfigxUfc7RW01It6JFtPShpFEZSWhrXAEMvdrqhbGU17+5iFsWG 5LWflvvd4yU1/MgIBoKUSe8Q93/oqV18NKu4h3LFGR3jv/lokDK79Wj4gtNVnDOlbA3s fmzbpRoapV9be7eNctXehit4DypV7pDq0GYUQyfueg8Ci8R7yntteP0/jJL7NEBJx6Xp k2AIedTW12+RYpcLPoxbwVxOecFZgmc8Wm2HCScAgy0CIf0R5d0XU3ACcOxnsfZ9ZDw8 vuwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=WTfyIvoK; 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 k11si379229pgo.416.2019.05.23.11.39.50; Thu, 23 May 2019 11:40:06 -0700 (PDT) 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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=WTfyIvoK; 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 S1731608AbfEWShR (ORCPT + 99 others); Thu, 23 May 2019 14:37:17 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:53576 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731383AbfEWShQ (ORCPT ); Thu, 23 May 2019 14:37:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=mcI32xfmsEoQcujsoa3t+R8aU7MbjBpf8zoUWNfm5Mc=; b=WTfyIvoKVJm2DtUE/xPqWyYm+ Z0YNQ6XiR2MOOAu+0LvMWrNrpmIaQYlAXhcb1EkVK0yf4yZmSN3JFep+4miWgbPzPJyVVR1w1Ox3h auWVTq8Zue8S7pfTCV0sfCU3vS0Qj5jPsbsPCGHr3NmFY5ZATleXTeHZWt4MyNOdf8vSBkIPYxJLK wO6b+VxTYrkEOI2zTm0LvCjqyMZBGtB81IhsgJZT/Auj/8FA/F7FPWMtVr+s7sYDSF08ckTEKytJq +gsKFxg7ihVs8pvvq5JBdorV8+zoiycyDywe9Jjg40fmAAS2NrzkIVDXt2RQY16w8LqMQvAGnDAng 4QH435N1Q==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1hTsaX-0005kv-P8; Thu, 23 May 2019 18:37:13 +0000 Date: Thu, 23 May 2019 11:37:13 -0700 From: Matthew Wilcox To: Johannes Weiner Cc: Andrew Morton , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: xarray breaks thrashing detection and cgroup isolation Message-ID: <20190523183713.GA14517@bombadil.infradead.org> References: <20190523174349.GA10939@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190523174349.GA10939@cmpxchg.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 23, 2019 at 01:43:49PM -0400, Johannes Weiner wrote: > I noticed that recent upstream kernels don't account the xarray nodes > of the page cache to the allocating cgroup, like we used to do for the > radix tree nodes. > > This results in broken isolation for cgrouped apps, allowing them to > escape their containment and harm other cgroups and the system with an > excessive build-up of nonresident information. > > It also breaks thrashing/refault detection because the page cache > lives in a different domain than the xarray nodes, and so the shadow > shrinker can reclaim nonresident information way too early when there > isn't much cache in the root cgroup. > > I'm not quite sure how to fix this, since the xarray code doesn't seem > to have per-tree gfp flags anymore like the radix tree did. We cannot > add SLAB_ACCOUNT to the radix_tree_node_cachep slab cache. And the > xarray api doesn't seem to really support gfp flags, either (xas_nomem > does, but the optimistic internal allocations have fixed gfp flags). Would it be a problem to always add __GFP_ACCOUNT to the fixed flags? I don't really understand cgroups.