From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 546CCC433DF for ; Mon, 22 Jun 2020 18:04:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1D82520767 for ; Mon, 22 Jun 2020 18:04:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PQ8czgD4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D82520767 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A8C916B0002; Mon, 22 Jun 2020 14:04:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A3DAA6B0003; Mon, 22 Jun 2020 14:04:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 92DF46B0005; Mon, 22 Jun 2020 14:04:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0225.hostedemail.com [216.40.44.225]) by kanga.kvack.org (Postfix) with ESMTP id 75E486B0002 for ; Mon, 22 Jun 2020 14:04:30 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id EC97B3335AC for ; Mon, 22 Jun 2020 18:04:29 +0000 (UTC) X-FDA: 76957622658.22.seat59_4b00a8526e34 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 3723918029B5A for ; Mon, 22 Jun 2020 18:03:38 +0000 (UTC) X-HE-Tag: seat59_4b00a8526e34 X-Filterd-Recvd-Size: 4767 Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Mon, 22 Jun 2020 18:03:36 +0000 (UTC) Received: by mail-lj1-f196.google.com with SMTP id x18so20372254lji.1 for ; Mon, 22 Jun 2020 11:03:36 -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=j6uNblF/rXntI2vUFLHgVoQcOmV81G4Sdgcnf6Y/+mg=; b=PQ8czgD42vYqwGYRKTO2n84gpWsgACtpIyto/Qj+3uP0Fp23q3YhCvcvrkOVpYPhbB 7r0U/ZLlxkT9dNsUuP1YLtZxJN1U5xGUd+s9TuNYaH80Uf+SWChxTFREe81qxHferMAu nQgbZexkvAOT2kZsBgMA/D8ctQeOicnFcn/oVl7Nz9Xz+YexO2EJ7fJQqP1US/p95hLz t2eiLQSnwQXQFdxFFZVFWi+vTYSTFsB/YDMnESWUcLGLzvUSnVKmGxIDEQj9f3tpoXK8 c++d4d/3UNVEfiSCgIyGN8xZvJxPg+HoNffbgr0qzMr17GhZGxioj6iPK3QVp/nw9M7G E1pw== 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=j6uNblF/rXntI2vUFLHgVoQcOmV81G4Sdgcnf6Y/+mg=; b=agp42t4zsbBGgNvUC1Unz1scBHTSnGEUhrR3OhC6VX0C8stwqqhC3ttOkqLFeVtluB OBsxpNr0JpS7ByVI+AGJsucIkxWdw5sPXJBLFQCXKo+XwU/9flmawL0e283cpdC1CuqZ AO4vf75vhbT9ykMfbgIGuNPOyg5d1sbU58LNKAcCCo7fZbv0bg9uEDY+trDW5P0aCqYX ROdcw43BdNgDO3vV59osnFIFHESuzArsoqzNRrRi4VpG1erpV8Qcyrnkvh0QnV4C65/a bJOJ3nHM0A7SAuSbCG8037p+I9WGxGdM+DwdavmoHUzkU+0v8uLU/ZCVkwq8WFKHzT5H cd/A== X-Gm-Message-State: AOAM533plJpuV5AbJ7fPiWD/qsi4B6pkH6yrh43qHAVOoe6MtrwVsX5v RjJFxotZzDgNthS7DqD29t0P5nLDexN3fFkdVm43FA== X-Google-Smtp-Source: ABdhPJyF/4zJuz+o/BmV2JOrZPUd49gn+SLi7pW8uR5OeFRcTVNp6E0zC1bo8zna5f6JF2YpMqsO3uhFJ+g+efi9uPc= X-Received: by 2002:a2e:8754:: with SMTP id q20mr9392152ljj.270.1592849015104; Mon, 22 Jun 2020 11:03:35 -0700 (PDT) MIME-Version: 1.0 References: <20200608230654.828134-1-guro@fb.com> <20200608230654.828134-14-guro@fb.com> <20200622174035.GA301338@carbon.dhcp.thefacebook.com> In-Reply-To: <20200622174035.GA301338@carbon.dhcp.thefacebook.com> From: Shakeel Butt Date: Mon, 22 Jun 2020 11:03:23 -0700 Message-ID: Subject: Re: [PATCH v6 13/19] mm: memcg/slab: simplify memcg cache creation To: Roman Gushchin Cc: Andrew Morton , Christoph Lameter , Johannes Weiner , Michal Hocko , Linux MM , Vlastimil Babka , Kernel Team , LKML Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 3723918029B5A X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jun 22, 2020 at 10:40 AM Roman Gushchin wrote: > > On Mon, Jun 22, 2020 at 10:29:29AM -0700, Shakeel Butt wrote: > > On Mon, Jun 8, 2020 at 4:07 PM Roman Gushchin wrote: > > > > > > Because the number of non-root kmem_caches doesn't depend on the > > > number of memory cgroups anymore and is generally not very big, > > > there is no more need for a dedicated workqueue. > > > > > > Also, as there is no more need to pass any arguments to the > > > memcg_create_kmem_cache() except the root kmem_cache, it's > > > possible to just embed the work structure into the kmem_cache > > > and avoid the dynamic allocation of the work structure. > > > > > > This will also simplify the synchronization: for each root kmem_cache > > > there is only one work. So there will be no more concurrent attempts > > > to create a non-root kmem_cache for a root kmem_cache: the second and > > > all following attempts to queue the work will fail. > > > > > > > > > On the kmem_cache destruction path there is no more need to call the > > > expensive flush_workqueue() and wait for all pending works to be > > > finished. Instead, cancel_work_sync() can be used to cancel/wait for > > > only one work. > > > > > > Signed-off-by: Roman Gushchin > > > Reviewed-by: Vlastimil Babka > > > > Why not pre-allocate the non-root kmem_cache at the kmem_cache > > creation time? No need for work_struct, queue_work() or > > cancel_work_sync() at all. > > Simple because some kmem_caches are created very early, so we don't > even know at that time if we will need memcg slab caches. But this > code is likely going away if we're going with a single set for all > allocations. > LGTM. Reviewed-by: Shakeel Butt