Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp624693yba; Wed, 15 May 2019 07:15:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzrR3uOeQHXvafB9DJnFMv3C6RDLaPMetXXDeyEmGBv99t7Hz/uRevoay6Cu+328Z41ylcB X-Received: by 2002:a63:f44f:: with SMTP id p15mr44208939pgk.65.1557929738188; Wed, 15 May 2019 07:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557929738; cv=none; d=google.com; s=arc-20160816; b=oDoAkrDxB7H5CicCnrDBfqlb0b9zNAVUtNfUrEiGcsAP86TCSSO+Vy6A0KzhTxaike SIbBC1vhbGV71APeOD3GkBeKW5X00STAPFLhtp40xd7GNrLgU5/Z2zR50+LTysQbquH/ jmPugjMf1j+O70ezqmKAu2Q3OeH9K85NwEfvBlm0Qe/l03PGobKtuHtckFuKLoYzCtMw 1PqPepKBIMojkZelQqvhoDYjl5Hw3u2XLiz/gO2q9QLJQFXxp4JIw4JP/ZfpuJpDGZ0e 4G73lXiSnrPGmSo6+wiplMmkRMVBuAT9QrTaQfGlT+DCwmZGDjvA6r4loTsF52JNyraF luTQ== 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=DkABSB9+ocVSEDM1acJkspFNCkj7bZrir9llBRZBZbk=; b=Ub3cP20dRYtHlmOpgRSMkCG+LyVRFdVr0cT8wwCd1jQIwKUhCJwnUwcGhhl9bnt6Uy WOOZ/tvsmdtZI8Jy2MTwLPNJczE7EPmseYiN3lTCEOz3Cds/iK5/0aKlHx64KzoHZ9p3 nhr35lmvrpaM2r6vbUuZkTe+sczsbjNGh6TY3DKg2dzlm0WP85nH6mL8tc6LK5x3qpdq TB66+PElV26tROCT0aIlx89RLaeuvrwCJJFnq2dB4ifR/W6y6JpSUHcGYwpf3JhN0/0E da69FXBbzW0SA9BX4G5ek4UT+su7YBR7IlTJjQ36R24o4jQcC9nncGxTdR7jZ6vcd5fO LdeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=diNffEIX; 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 w3si1934407plp.260.2019.05.15.07.15.22; Wed, 15 May 2019 07:15:38 -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=diNffEIX; 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 S1727592AbfEOOLn (ORCPT + 99 others); Wed, 15 May 2019 10:11:43 -0400 Received: from mail-yb1-f193.google.com ([209.85.219.193]:40745 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727018AbfEOOLm (ORCPT ); Wed, 15 May 2019 10:11:42 -0400 Received: by mail-yb1-f193.google.com with SMTP id q17so972780ybg.7 for ; Wed, 15 May 2019 07:11:42 -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=DkABSB9+ocVSEDM1acJkspFNCkj7bZrir9llBRZBZbk=; b=diNffEIXfA/QFvQ4JDN4yWPbBFk9QYgBHQ4+BVJ1NfD0TF6g+5vVE0YSL1BnVjtejf CrAeQK4hrTmj1WQuMCeXacIymo+qMfuKsRMkXThtVIfdGWD3UWU68tOQie85EkAx3kZA YA78rnXPrmWhtTDNmjqohIlpLATlRKpAgbVUzdHZ/0oIWDRCWeJPe4MkeQfL4NNPlAhb 5gw18O/g48n/nZ7gRYd6s2xdXe7fCpmxbuVDtTd8Fhd7nK4blg8+HLxt6MmLicorJV+J ANLAPFx1lNLWprZ3HdLcTYYUg1gfx/xT6ADtn2L5nwfSQpvrZp2SEK2dbyUh8ZEYZ9Xq UKcQ== 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=DkABSB9+ocVSEDM1acJkspFNCkj7bZrir9llBRZBZbk=; b=OPCFVvDBAkOudy5p4iODlM3oaIfnuTE0rhkvLvO0VCB3lC5MbHPer+qUMNvRG84tjI NdLhvzEoBN2n0mKaba3zeDpdc9F/asJLa81ZMu3yJaVZQBx2q/jdteSUSMpPsSarkUWU 1n6XEfxrrLNHYWvsNnUE810RaLKqxD+ySprdqgNAujmiNd5MidO25eKzhHdtJoeIvij3 47fsjVHPL9pKB/eR0wz2iTwr8EWHRXZ3Qg96piQiVzauz1HjIkWUkaBXiUifWjkp0HIr BTvFV89s8ybB/ZzDjnFH0CMp2x24u3Ih6WCw1dUGyzpuIvTKSfdyeyB6jEZvzlSkNvBQ B75Q== X-Gm-Message-State: APjAAAW0q/lePWbBqdR2bg6M9Ld2dRpi8O0HKYSQu4daJrt27b1ReQHj 9FCTWz82jvtflRS+/caE57RX13V+x4QPtMxdhY9uQA== X-Received: by 2002:a25:4147:: with SMTP id o68mr20740148yba.148.1557929501573; Wed, 15 May 2019 07:11:41 -0700 (PDT) MIME-Version: 1.0 References: <20190514213940.2405198-1-guro@fb.com> <20190514213940.2405198-6-guro@fb.com> <0100016abbcb13b1-a1f70846-1d8c-4212-8e74-2b9be8c32ce7-000000@email.amazonses.com> In-Reply-To: <0100016abbcb13b1-a1f70846-1d8c-4212-8e74-2b9be8c32ce7-000000@email.amazonses.com> From: Shakeel Butt Date: Wed, 15 May 2019 07:11:30 -0700 Message-ID: Subject: Re: [PATCH v4 5/7] mm: rework non-root kmem_cache lifecycle management To: Christopher Lameter Cc: Roman Gushchin , Andrew Morton , Linux MM , LKML , Kernel Team , Johannes Weiner , Michal Hocko , Rik van Riel , Vladimir Davydov , Cgroups 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 From: Christopher Lameter Date: Wed, May 15, 2019 at 7:00 AM To: Roman Gushchin Cc: Andrew Morton, Shakeel Butt, , , , Johannes Weiner, Michal Hocko, Rik van Riel, Vladimir Davydov, > On Tue, 14 May 2019, Roman Gushchin wrote: > > > To make this possible we need to introduce a new percpu refcounter > > for non-root kmem_caches. The counter is initialized to the percpu > > mode, and is switched to atomic mode after deactivation, so we never > > shutdown an active cache. The counter is bumped for every charged page > > and also for every running allocation. So the kmem_cache can't > > be released unless all allocations complete. > > Increase refcounts during each allocation? Looks to be quite heavy > processing. Not really, it's a percpu refcnt. Basically the memcg's percpu_ref_tryget* is replaced with kmem_cache's percpu_ref_tryget, so, no additional processing.