Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2129476ybm; Thu, 23 May 2019 11:51:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLJqGWyX+jk9a8P/xT2IjmBDCtTn937VtJ9E7lNOzNQYPtndG5nGGG8lqoxnn5ce0X389B X-Received: by 2002:a17:902:e409:: with SMTP id ci9mr90490108plb.103.1558637479750; Thu, 23 May 2019 11:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558637479; cv=none; d=google.com; s=arc-20160816; b=a+pcFb4Uf84W8PqPvIPmcjH1ohRPOSXWlp9hexUWKsZRhY30mj1NqTwdprseOX9bQR D43S/ttdl5b43rxkScHxNzcCpTCsfZIgxRX7+IXjuh7/DJbz51dx0rthZG8gDUMvCTq9 DNOuLVFAnhr21Jl5ZDJj8vmh8qPtvuWn3b50OFQkpbNBMKkbRDtVq35RcgPFUIzbHqj6 mpbwsAHl5dJ2AvwmT8UdZmQmnxP16gyBd1CFdSLRSscFhcoGIiehIAldND0uCYXMU2M5 aaoBwEF7n67/1GiHOlwHnWDlgRx3OsMER+1n2/3ENrAIWsnQeYOcRKbGQCOjh4tZxfnP GgqQ== 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=q/4hzu5ZLVp3mgIPesJPmq/IWbfe4flwA2HG1sCD0TQ=; b=oXiqKGskXw0ArwjrHUXJbKlOd1TOcjoY3XCxZ6QYH/lTdUndRdR8xJXUwfAKYv1Bem SNChtCCgIQ7iJq/0irGTkiwdgaEVkqIZDuPRe7KM1rtUAJMZX3L/75+YGO+7HhoqdYkU V3wczoI1jKN57gCvMs7rlJ+Kw5W32tVxMK7K0P6d4KEdl2eXowNqoPpxNa50LBHLQvhh ftN6tYwXjRo8gP25Q5RQK+4RKyjAZ8CtoBlcpQS0IYpVw3oH98itEVOEgMGUFMlNZSCt LVgByWQFNxD1fg+CUaRiSyFpa+oDFjOnWg2WO+2J4laQqS4ufyGWWegfX8VnXcT+PnEj 98QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="u0BN/6Ny"; 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 d24si248296pgm.405.2019.05.23.11.51.04; Thu, 23 May 2019 11:51:19 -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=pass header.i=@google.com header.s=20161025 header.b="u0BN/6Ny"; 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 S1731505AbfEWSty (ORCPT + 99 others); Thu, 23 May 2019 14:49:54 -0400 Received: from mail-yw1-f49.google.com ([209.85.161.49]:42929 "EHLO mail-yw1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731397AbfEWStx (ORCPT ); Thu, 23 May 2019 14:49:53 -0400 Received: by mail-yw1-f49.google.com with SMTP id s5so2655292ywd.9 for ; Thu, 23 May 2019 11:49:53 -0700 (PDT) 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=q/4hzu5ZLVp3mgIPesJPmq/IWbfe4flwA2HG1sCD0TQ=; b=u0BN/6Ny8Z4+blOm22Z5UCSC8Wy5XnV4pzNa9RSEvcRmexqQPvcwNghBha2X4MQ36C 7dzsdV+f6ydrqcsngoZ6b81Z6BiBjBfDHoUWeZaLAK49agcruYHxVKfgwvl6vkbI7a2g qWF7FK3K5DeBcV4zvxpXp0o81by/At5dYBRjnk7yfQBXl0RTZNucfLEpe2dPkSFCumKX lM23S8zrXdpTm2qs3mlX+TjAUJg+SGmA3p+ePvgDlWxlg/5n+eJfvBZ/ka/EFGLzfvai bSt2zk6ItfPP82e9IfgqRiHMA9BW3IYp9vtRWaIl180exc8Z8hQL9gAUR3c4PwBkBOO2 q+Yw== 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=q/4hzu5ZLVp3mgIPesJPmq/IWbfe4flwA2HG1sCD0TQ=; b=m8zyB0fvAZ+2G6jFniR64pk0oRa0EMsF7IIFT9DImYbINBuwcuPJo3kukpiTrLrZ5u OegjNzEk5ca4pObDkCYvpKiwNq3nsnr7503PwH7zWJsbudaWu+qpWMgF8JFPJIFBrkye 2xODCiFuxKlIne+a5mnx/1UEbUpzabRR1GOdQFVWpyS0KUzwQsx3k8f+TXyR/sajPKdm kuVNpZSyFKVB2vvZbB3CZ5Igji5DMvP28sfBsawL0xaiSsvhcDv+BQm+ps4I1ISE1N8t KulF6B7Wc5XGE6PrSbfVQeE+1aZGT8HZqFTaEn6YQslSkbFhYhr4VuACRXr5NzGPWgS8 5sKg== X-Gm-Message-State: APjAAAWYeMpEObKyx3qL7rrZI+nVas2gl2ujKtT3zscc1VPxmkcRNv4y gr/A44KmmJT/+iGWufwr4IoYnKVE1jdbLbhmlZOdRw== X-Received: by 2002:a81:5ec3:: with SMTP id s186mr47879009ywb.308.1558637392374; Thu, 23 May 2019 11:49:52 -0700 (PDT) MIME-Version: 1.0 References: <20190523174349.GA10939@cmpxchg.org> <20190523183713.GA14517@bombadil.infradead.org> In-Reply-To: <20190523183713.GA14517@bombadil.infradead.org> From: Shakeel Butt Date: Thu, 23 May 2019 11:49:41 -0700 Message-ID: Subject: Re: xarray breaks thrashing detection and cgroup isolation To: Matthew Wilcox Cc: Johannes Weiner , Andrew Morton , Linux MM , linux-fsdevel , LKML , Kernel Team 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 On Thu, May 23, 2019 at 11:37 AM Matthew Wilcox wrote: > > 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. Does xarray cache allocated nodes, something like radix tree's: static DEFINE_PER_CPU(struct radix_tree_preload, radix_tree_preloads) = { 0, }; For the cached one, no __GFP_ACCOUNT flag. Also some users of xarray may not want __GFP_ACCOUNT. That's the reason we had __GFP_ACCOUNT for page cache instead of hard coding it in radix tree. Shakeel