Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5559555ybi; Tue, 28 May 2019 15:19:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVRRyEwnRT3/NF1um/uHDHwhsgt7dXfcz0XFAXTefQ6IzTQkz/Haj8dTpvyxCjIamIrN56 X-Received: by 2002:aa7:8248:: with SMTP id e8mr36395551pfn.155.1559081982766; Tue, 28 May 2019 15:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559081982; cv=none; d=google.com; s=arc-20160816; b=y8L2iji58ln2MwDBx6WHSkybbMOAtL6HKwd8kIrGmPdf+1csEh1bYGrV2VB2/j06Ma F/tsoP35h5ye+VsQxPQXEfX7Q1KzCTyVY2B2Sg5EVn/IkgD8Fwmpxtk7GuVXHLjhkBi1 eClv/OmzvI0hPMkQdEc5fnrgwEuckPcM8t8Mfgmtpq4tKZK5SYTWJ9E6m6COSK77ghld l9zc8ZRSKZY+GqB152gbYp9FwWk7U6W9B36sN2H9YZQJujdGaMRA5rkvo2WgwmEcrNmN F4/OY0QAjv6+l5MH8TuBuae6Gi1SAVC9D7Ad/jatEauw0ULdWNz0kJTrXlZG2FzREZg9 PdwA== 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=ZB6HVXPOZ6dJd49xc2bEcD13tElE9byJqAMfahspmoo=; b=u82JE5BHtqLJY/xHg5OBO0l8HYW/BLU44S/q6xXXaLMPn7jhucX0Zf9Qs4epc3s7go uW6DboCRvpG53gLNL+uk69dozehDMH+gGb3YiI5+KbjM4rhl+M7Dv14n+2AC/22PppG6 dlleWi2nVbbSuQvovPFEFH5wO0kfra5Em9BJmq8gBYXR3C+9cPnWhaoP5deZAMICcwC9 nJXf+9THKh9ptB7veinrUjdzHID/E0oK2W3ZnHe/kfjwZvk3+fq1MEasdmv6gtKObqYt +Mr+kej3D8niGKeuHayypVgK1rnm6ePG9kWSf845gklaQB1Q8S1Ywiiky52RrWlV+EYU rS/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=ToLngH1j; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m191si23825256pga.17.2019.05.28.15.19.27; Tue, 28 May 2019 15:19:42 -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=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=ToLngH1j; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727695AbfE1WD4 (ORCPT + 99 others); Tue, 28 May 2019 18:03:56 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:45500 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726576AbfE1WD4 (ORCPT ); Tue, 28 May 2019 18:03:56 -0400 Received: by mail-pf1-f196.google.com with SMTP id s11so136659pfm.12 for ; Tue, 28 May 2019 15:03:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZB6HVXPOZ6dJd49xc2bEcD13tElE9byJqAMfahspmoo=; b=ToLngH1jdhNI9UHTF8mqD15qUyNQONEg/Z1t3IceMNsoGy9/azm9l4mpXuBFjzeaNU DF0dDXbXAvHbBYG0zaQQPpZ/V9sOMriSfNAjQuG5jB3Z+5sMan2GbE4PmLqavh+/yWBT dBgFl+Y0x0ZlpdGRI0ttZdHXZKhRYg/Mc4cf+maDZn3pGpuX+sEs1wWdvYCtv4U6SS8v 2sZKF5aqRSTCE8fqQLDzWJzu+yMg5zVT2DhXjcFim48rFB+G6IWcYilRZeLczdJ2Jm8l iNuAb1Z6C7WuucQuNmOjutEP7zMEQcJU0AxxjHeZCcGSZVyvtBwq7unQv0RRuwvFOdlg hntQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ZB6HVXPOZ6dJd49xc2bEcD13tElE9byJqAMfahspmoo=; b=pPsOVS2ajZY1+a1aHg5f4NDtwHMop+04nqjv6osH2ScVVei9Ofr3t0248fkuzQR4Ed wfRoii0R8U6hEIzAjQguPQbJgM3awqQiJbRdUq8sUaybBTVigdq8qMYst7Baq8+SMKZr MvBz1v28gXOsA8NiOM51KTOvVvDCfMou4Hf1wdIVVHPOReY1L7bPWiRHVZxCd6gIXWZu W1dB0kEOnHKc0KydFvz/D5RNuLhvc1xr1S6UUG/NAw02pzxtnPxj4xv7kDtHCf/VmZqD IWRrFMvViJ9qaq1R2HQ49PAbdfOVPfHUFtSVO9xlcNHE5F4C+aZwwtq84HsTWQn2ouf7 GCVg== X-Gm-Message-State: APjAAAVz6SZ31T+33Jx+0ceo7EdIsDho2rSTbo15StlLJRIqz9n0p2jl 8ocBQ1ZIJaruBdeujCa7Ogne1Q== X-Received: by 2002:a62:75c6:: with SMTP id q189mr143220121pfc.98.1559081035831; Tue, 28 May 2019 15:03:55 -0700 (PDT) Received: from localhost ([2620:10d:c091:500::1:77ab]) by smtp.gmail.com with ESMTPSA id c97sm3674631pje.5.2019.05.28.15.03.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 15:03:55 -0700 (PDT) Date: Tue, 28 May 2019 18:03:53 -0400 From: Johannes Weiner To: Roman Gushchin Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, Michal Hocko , Rik van Riel , Shakeel Butt , Christoph Lameter , Vladimir Davydov , cgroups@vger.kernel.org, Waiman Long Subject: Re: [PATCH v5 5/7] mm: rework non-root kmem_cache lifecycle management Message-ID: <20190528220353.GC26614@cmpxchg.org> References: <20190521200735.2603003-1-guro@fb.com> <20190521200735.2603003-6-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190521200735.2603003-6-guro@fb.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 21, 2019 at 01:07:33PM -0700, Roman Gushchin wrote: > + arr = rcu_dereference(cachep->memcg_params.memcg_caches); > + > + /* > + * Make sure we will access the up-to-date value. The code updating > + * memcg_caches issues a write barrier to match this (see > + * memcg_create_kmem_cache()). > + */ > + memcg_cachep = READ_ONCE(arr->entries[kmemcg_id]); READ_ONCE() isn't an SMP barrier, it just prevents compiler muckery. This needs an explicit smp_rmb() to pair with the smp_wmb() on the other side. I realize you're only moving this code, but it would be good to fix that up while you're there.