Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1270699ybz; Wed, 29 Apr 2020 18:33:46 -0700 (PDT) X-Google-Smtp-Source: APiQypJlGv8WmOkKt0WTzGbLkseKqs/KO9xGUyms6YnJZZSDc60Gm4I6Pd0xm2w8bWuKnYgKHskD X-Received: by 2002:a17:906:7d7:: with SMTP id m23mr522994ejc.154.1588210426179; Wed, 29 Apr 2020 18:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588210426; cv=none; d=google.com; s=arc-20160816; b=VsOkEhgUvjpkloesOsF9bslxDPUFWTkJr5m4ZURuQIGG+kmFtSTOGaAwIegqLS+aWs uo/J8n4jCVwANMb1drTNptP0bLWfSYlX88AQjLJb92ZcxVSmQ9ZbKJK6oZDUcfmwi3KG pq+0KhwmTZk7rq8GdxTBtyCt6DRl8cD/JOcUIAiBmzYgY4Qhy9a5NaeDJjHOa4hFa5AP opT+d9BtGhejSXEWBxcZKloQ+MAQ55ohOWaRlwMH9Ve158dKpmZnGXTsBvKYyL9PVrrm /DvD2Fx+faWci6NRztP8Lm8TwLTE5uc5VPzKjtvMy5Yw1C/nHW+SliK3p/lGUppE3b/C n67Q== 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=0w8kJY9j/FEki6CAhMOKe13kIgQ0o8hCyo6pGzmOYdc=; b=FTyTu7mRJTdgFt7EFFvSFLwHHTDc1pmFrVk3WvuaBkJEBPGH5vgec2sNQcu1XjnIfY PZfeOaa88c1XtRarDI0I1e7ruli3Cy9/LnqOvzSF6E7ZJ0rdYoecf0mD75VYjm74JZlR 0CKA6AQ5Bppl/3UftKzy4x2KK7Yub6kQeGMtiMP6akwkaY8+SkUPjwfPVAmskxejeaNO s6zMu/kpj6zi5OaLZ9FX6FdNYr1KGeAEpk/j0W/SEgs1oBxUySNkhrAB5CAuSA55/ybj WaY+b778iyUPYABmOKkKXAvdlhM/s7HfUKJh5Iav4gSVfzvQQ5aofXM79V4lE9MtuekN Ps+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MPwVE+Bk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m13si4917485ejc.7.2020.04.29.18.33.22; Wed, 29 Apr 2020 18:33:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MPwVE+Bk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726539AbgD3BcB (ORCPT + 99 others); Wed, 29 Apr 2020 21:32:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726466AbgD3BcA (ORCPT ); Wed, 29 Apr 2020 21:32:00 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89986C035494; Wed, 29 Apr 2020 18:32:00 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id k18so3568639ion.0; Wed, 29 Apr 2020 18:32:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0w8kJY9j/FEki6CAhMOKe13kIgQ0o8hCyo6pGzmOYdc=; b=MPwVE+Bkz9CcDJalk+jgqmR3yxPIKUJC9RYNqy7zduk8OZljggsMW54Iu0DIGQxaKG fdbwsrCCpogT+InOFKVy82EoAxMwVggL1RJOkUH2Q02y1wlfKbCrlNbt5CcaVv20Z+FL vtJXW1aC5Aw5Wz4IGBUkzIkcsn6XtJeWsA8S0Z8MAX9Zv5uI6T42mM0xogcGR76LyuCH 2geNetHgdjA7o06cI3ZjVvsDPq/TlwcYzBJL9HfhiTot/9NI/D+pT2RhoTnJblRugKJo kqomD+/oVM6lCXM4NUSGp/oVrh5MHBenNP42ujYcZQF7JDZ/4qmFgrnvvnD4lCrrwxyd J1kQ== 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=0w8kJY9j/FEki6CAhMOKe13kIgQ0o8hCyo6pGzmOYdc=; b=aujRmef9ltzCJaHiqw/F2B1KHkjvVlk75X8kmKlFmpvyrca3ktFa5Zj3TLV/rkDR3k 3rEaUOKgp2k76JDN3Y/Dzgw5m8pj0SMk/wqo+OraEcb/5Ns7Y0Yzii8zPIHW1zXmA7TJ QXsYU6luczLXiQNBdvzJ5STZ0mCXcJCwZ9M/v5xNfEUdkpuSA5vN1K/XP6kd8onHhXmf 9Dvp/zue2svPauAqD+u9We+GP6KsVLvwpdvgkxhcEWDZlqimaCqtQsZ5uvHMNkx8Y7KE p7KsssPwLuNMguWHUuFBug6mU8MfXMGmRrB9MrA58vVyAMzNAAYtxO/xInes2hjtxC6t wrUg== X-Gm-Message-State: AGi0PubrWQjzcwaTnzcj3X+XC9FOl5ZIRscgaQIqitZkRtZUptK06HwM JyrUOgAsSjFNCq2lbcuxEq5gBNg5+ZSrXlH9Bu8= X-Received: by 2002:a6b:3c0a:: with SMTP id k10mr1002541iob.10.1588210319908; Wed, 29 Apr 2020 18:31:59 -0700 (PDT) MIME-Version: 1.0 References: <20200430011626.GA2754277@chrisdown.name> In-Reply-To: <20200430011626.GA2754277@chrisdown.name> From: Yafang Shao Date: Thu, 30 Apr 2020 09:31:23 +0800 Message-ID: Subject: Re: [PATCH 1/2] mm, memcg: Avoid stale protection values when cgroup is above protection To: Chris Down Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Linux MM , Cgroups , LKML 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, Apr 30, 2020 at 9:16 AM Chris Down wrote: > > Hi Yafang, > > Yafang Shao writes: > >Would you pls. add some comments above these newly added WRITE_ONCE() ? > >E.g. > >What does them mean to fix ? > >Why do we must add WRITE_ONCE() and READ_ONCE here and there all over > >the memcg protection ? > >Otherwise, it may be harder to understand by the others. > > There is already discussion in the changelogs for previous store tear > improvements. For example, b3a7822e5e75 ("mm, memcg: prevent > mem_cgroup_protected store tearing"). > I'm sorry that I missed the changelog in the other one. So you'd better add these commit log or comment to this one again. > WRITE_ONCE and READ_ONCE are standard compiler barriers, in this case, to avoid > store tears from writes in another thread (effective protection caching is > designed by its very nature to permit racing, but tearing is non-ideal). > > You can find out more about them in the "COMPILER BARRIER" section in > Documentation/memory-barriers.txt. I'm not really seeing the value of adding an > extra comment about this specific use of them, unless you have some more > explicit concern. My concern is why we add these barriers to memcg protection specifically but don't add these barriers to the other memebers like memcg->oom_group which has the same issue ? What is the difference between these members and that members ? -- Thanks Yafang