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=-0.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 E4DF4C83004 for ; Thu, 30 Apr 2020 01:32:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ABA182083B for ; Thu, 30 Apr 2020 01:32:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MPwVE+Bk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABA182083B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 460AB8E0005; Wed, 29 Apr 2020 21:32:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 410098E0001; Wed, 29 Apr 2020 21:32:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 326AA8E0005; Wed, 29 Apr 2020 21:32:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0056.hostedemail.com [216.40.44.56]) by kanga.kvack.org (Postfix) with ESMTP id 1A7C78E0001 for ; Wed, 29 Apr 2020 21:32:01 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D415D180AD815 for ; Thu, 30 Apr 2020 01:32:00 +0000 (UTC) X-FDA: 76762795200.06.sheet57_2ea4c88b4a61a X-HE-Tag: sheet57_2ea4c88b4a61a X-Filterd-Recvd-Size: 4434 Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Thu, 30 Apr 2020 01:32:00 +0000 (UTC) Received: by mail-io1-f67.google.com with SMTP id f3so4450734ioj.1 for ; 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=rhfbY/whCohbEuqEzbSF5XXi6Q+zO0FeeTGCM+TT6ECMGM4TcWuIEw4LqrrwmAFLg7 4qndbwY0UGXjbdIJVMgVBkCPybmwrqNwY8T7kVkmQxwV9V0drwk1UttVH6cvywKu5I0o GCLJj19tvdgW8m5NUhUb5RY44lor3qGBmwEXKdaM5OQgIRa5OKaW8U01zf37MYjvmZcS PHPUUtrih6XBQgS4F/Rc8xTFY5vMwq8JLcjXDYgfUErNebZbs+TbYVnZicgxi8F+Y8b5 ixprGiDKwW0/Uf/d9QuwfOuMpAI+7eqkKagODrA0jmNtdSHVzhPB0X20WIly6BBm0o8h oF0w== X-Gm-Message-State: AGi0Pub38id0L7VGK3vxzZdC2gD0otIrt0kXdfjsbXuUplOidYeAuQYv o9sgqHeXaJbabm3MPQqFuTHqT2L+EddoXzK0TXeMJzlRrv4= X-Google-Smtp-Source: APiQypLz8FaqWq2KOraprYF34ICk96Epr8NTd6xyOTTliXByvTRhVsnLYttoWEeIb2tqNvg6vtoysi3FjHUndN+hZtw= 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" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000552, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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