Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7011685ybi; Wed, 5 Jun 2019 09:45:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqwuBySPhxkFMXclVKbVmhbqSubaNWm5S4eXGdwAkLELG9XRYaLQoZqAg7UnVX8sw8UC/RWL X-Received: by 2002:a63:27c7:: with SMTP id n190mr5779688pgn.250.1559753147946; Wed, 05 Jun 2019 09:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559753147; cv=none; d=google.com; s=arc-20160816; b=vkPx4yNn64ULXTJQipCokB7XwR8KUrmDjDMjeGrRnY7T0MlF1jYSsiKSq4vXLEn0QY bU2jzCN2UOUbOhHh0Qs0sbnAsfyNhwZsto/NHss2bpNe22nl0HccHTyJLaDNPrHzWtC+ ucj2lM/l8V9Z163Ku0tWFx+JFlPnykpnCKV/mVOWW+5jNkNhsjyd/KSCflE4lwG6/JXJ viYfGLa//fAWjUvSVqq1z4bkv34WT2OXPEG3PpN6uKoWyxwEyQnAKhrCG2dz6H0rYiEq mRPJxWFTcEi/emJX+Khgv/wAS3V1FwWo6Z51xn4N1mBAiOr8NLHQ0ZNIqk270LBlzu/h BvHw== 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=IR/5u8R+ftfvePhhPnEG7rK5T0D9AZJGfobf430HZK0=; b=dlnhyobeNY+4Nxi6twI1tLOUtNEXBjSIyBNuJCrsEzQojemopaob+BvIfuU5eWLg/Q zjGOYsfmGvQdlCstp75gsjVUifDgn4EXl9aAMlRibieLZtnK9d2kOI+btF/FMNF8vEBA BRA8iHP7Yrqv+hfbQVn/dLdQcnn7H1RkvxeXtCkNIxyqxHtse79WB+g6vGYLZri8+Vqn rhnIHBodsFfzUemlY0abBkVCl43a9etrXIUSh+WwbkxA4FwjS2w56NuMaP6bBCN/G4t5 FPI2WPGwxrrOAq13cgjoczfKfW0g1zxPk9QsuI13EvolzWLm23hvIeqMHZWWKBGHzkAU LgzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b="EpK/aD4e"; 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 67si27393469pla.356.2019.06.05.09.45.30; Wed, 05 Jun 2019 09:45:47 -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="EpK/aD4e"; 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 S1728773AbfFEQmb (ORCPT + 99 others); Wed, 5 Jun 2019 12:42:31 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:42989 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728263AbfFEQma (ORCPT ); Wed, 5 Jun 2019 12:42:30 -0400 Received: by mail-pg1-f195.google.com with SMTP id e6so11433636pgd.9 for ; Wed, 05 Jun 2019 09:42:30 -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=IR/5u8R+ftfvePhhPnEG7rK5T0D9AZJGfobf430HZK0=; b=EpK/aD4eGRpEC9hMVO208gbI/muqvw8jBmuMlOGu+QCJFEebWFWSoFCERzvwGvuL6K ZsZW1YedQmJCDs8eKJRuqXLHpxRuF8EZ0fn2kX/QObnsB/BRL2omZKd+WbVgXyaemLx6 nIziz08WC5m6Od5vkSTLH9UrAqUvEideQSFn7Kek1qFQR0L0B9Lr6mu9mZtZkMWsYh68 Lh26494NJ/EqpF12bz4dOK09y5nJtxJbA5Jt04y7H3ZUrW/7ymTys04XVtMiWIRbFDoZ avUuRe2ACDkCiyz75JTnDTlW2XCPbiknHuhU5mk9t7MeLU10/Q07/2PW5oCPCQB+ZlqU FFAg== 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=IR/5u8R+ftfvePhhPnEG7rK5T0D9AZJGfobf430HZK0=; b=tjzB9oI8I6UPFyolH53EPEsFhhds16CHVGUlCdC4QyKqCXP+z9LtmoLY0ILndoi+FG FUSGZ3TjYwHr4U1sBzL4p6+EFjg5PH/kMOOp66fPFWd9fMzbfap2uJ+f6H/OOuaOA9Xf zGC1ZcfOqUC4pey0j7DR4TgViIv0fbERc3NNFfVzlwyE5RO1t0PAJxzAK4WqPZTvtPox 4WEMBy1amlcMdoMcBqSQkuvcoGkAcJk3r6YJcOC/tFfFrIwel7Zmx8EfzbLLHU/tURBN eGbub/8rn0DPWd2+lp61DVOBP+JOPDwWV6+ub5bIEaJP8+O+SWuRUjZWiXrKgAIPZeRt cGEg== X-Gm-Message-State: APjAAAUKLkB0xyeQeqhFc1yeqt9Q6klW1Ky73eB9QrlbMRybSwr6WZ7O HauGfqgcKzmaCVUAXAZn3o8GTQQ9tGM= X-Received: by 2002:aa7:9e51:: with SMTP id z17mr48511176pfq.212.1559752950079; Wed, 05 Jun 2019 09:42:30 -0700 (PDT) Received: from localhost ([2620:10d:c091:500::2:cd0c]) by smtp.gmail.com with ESMTPSA id q125sm44812419pfq.62.2019.06.05.09.42.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Jun 2019 09:42:28 -0700 (PDT) Date: Wed, 5 Jun 2019 12:42:27 -0400 From: Johannes Weiner To: Roman Gushchin Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, Shakeel Butt , Vladimir Davydov , Waiman Long Subject: Re: [PATCH v6 01/10] mm: add missing smp read barrier on getting memcg kmem_cache pointer Message-ID: <20190605164227.GB12453@cmpxchg.org> References: <20190605024454.1393507-1-guro@fb.com> <20190605024454.1393507-2-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190605024454.1393507-2-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, Jun 04, 2019 at 07:44:45PM -0700, Roman Gushchin wrote: > Johannes noticed that reading the memcg kmem_cache pointer in > cache_from_memcg_idx() is performed using READ_ONCE() macro, > which doesn't implement a SMP barrier, which is required > by the logic. > > Add a proper smp_rmb() to be paired with smp_wmb() in > memcg_create_kmem_cache(). > > The same applies to memcg_create_kmem_cache() itself, > which reads the same value without barriers and READ_ONCE(). > > Suggested-by: Johannes Weiner > Signed-off-by: Roman Gushchin Acked-by: Johannes Weiner