From patchwork Fri Jun 12 17:44:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chris Down X-Patchwork-Id: 11602129 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 88FE4138C for ; Fri, 12 Jun 2020 17:44:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5520D207F7 for ; Fri, 12 Jun 2020 17:44:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chrisdown.name header.i=@chrisdown.name header.b="ExSMmNiI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5520D207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chrisdown.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5E32C8D00CC; Fri, 12 Jun 2020 13:44:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5947B8D00A0; Fri, 12 Jun 2020 13:44:40 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45B138D00CC; Fri, 12 Jun 2020 13:44:40 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id 2AA728D00A0 for ; Fri, 12 Jun 2020 13:44:40 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DD259181AC9BF for ; Fri, 12 Jun 2020 17:44:39 +0000 (UTC) X-FDA: 76921284678.30.smell52_3c151fd26dde Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id B77E9180CA548 for ; Fri, 12 Jun 2020 17:44:39 +0000 (UTC) X-Spam-Summary: 10,1,0,45b01286b4465707,d41d8cd98f00b204,chris@chrisdown.name,,RULES_HIT:41:355:379:800:960:973:988:989:1260:1277:1311:1312:1313:1314:1345:1437:1515:1516:1518:1519:1534:1541:1593:1594:1595:1596:1711:1714:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3351:3866:3870:4321:5007:6261:6653:10007:10400:11026:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12895:12986:13069:13221:13229:13311:13357:13439:13894:13895:14096:14097:14181:14394:14721:21080:21444:21451:21627:30054,0,RBL:209.85.218.65:@chrisdown.name:.lbl8.mailshell.net-62.2.0.100 66.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:1:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: smell52_3c151fd26dde X-Filterd-Recvd-Size: 3919 Received: from mail-ej1-f65.google.com (mail-ej1-f65.google.com [209.85.218.65]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Fri, 12 Jun 2020 17:44:39 +0000 (UTC) Received: by mail-ej1-f65.google.com with SMTP id dr13so10898582ejc.3 for ; Fri, 12 Jun 2020 10:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:user-agent; bh=El2ZhOBNpOphhFc1XzfVOf5zdV0ZOf8ZqDSCzO0pdXQ=; b=ExSMmNiIU7w2dNRKqM6HiRU9brV5dI+iTGVf+mxt7q63rlToikgj3nMb1iq3YADJBF ev3ed8upaGQ+qe9wjcso2C9F45/3Ud5jGOhB8d1Zvs+Wj38uxrM0oQtF8lKK95/K5WGi 81VPI2Bpm1n5W2VpKPUy+7srzOYLycHM1Rup4= 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:mime-version :content-disposition:content-transfer-encoding:user-agent; bh=El2ZhOBNpOphhFc1XzfVOf5zdV0ZOf8ZqDSCzO0pdXQ=; b=dq/Mba3w2GQweR0fmqCPKLJeA2RdE4c3qjH6rgaDFtj7y3NTMhMf6qf2lHVg5TTuFF j75byA8vfTSuN9q9NLuMh3nOBGOfiax/RpawtxspJNHsgHjRK0X4wuMzBy3YPYytzwhH H4C4M20btWNb5n5jJ3KKQXIIFacwS/4gb562DWBz+GqRM7qUlF+BQ4iR3ldc2EgsWk3a COg5pw82gdhNjg/3sltW07fIb6UgNXWfpGW//r4MZc3Y1EJN6OHaHf5vGd2MPyRIqYlu SGXhYJGoTacbLkrOvxr8codV/zjx9m/YIMEcUxg6UkOgiwqNthjlReIjvw1iZwbFbDr0 5eZw== X-Gm-Message-State: AOAM533HjaULLp6qPltd2uwUwXRRwAsiHspeFzHg4qqMNb/bIJFJ924g MLlAlMxA8+6YkPeS2GNM2MOCqQ== X-Google-Smtp-Source: ABdhPJxjGBObU+iuR5VFNURPaq/Kot+BO1JubX/YelHlAX2HwCoqdG4luT5UYW9Jpmd9kPxVsKQr+w== X-Received: by 2002:a17:906:c952:: with SMTP id fw18mr13976047ejb.505.1591983878004; Fri, 12 Jun 2020 10:44:38 -0700 (PDT) Received: from localhost ([2620:10d:c093:400::5:18e1]) by smtp.gmail.com with ESMTPSA id d35sm3443742edc.40.2020.06.12.10.44.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 10:44:37 -0700 (PDT) Date: Fri, 12 Jun 2020 18:44:37 +0100 From: Chris Down To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Michal =?iso-8859-1?q?Koutn=FD?= Subject: [PATCH] mm, memcg: prevent missed memory.low load tears Message-ID: <20200612174437.GA391453@chrisdown.name> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.14.2 (2020-05-25) X-Rspamd-Queue-Id: B77E9180CA548 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: Looks like one of these got missed when massaging in f86b810c2610 ("mm, memcg: prevent memory.low load/store tearing") with other linux-mm changes. Reported-by: Michal Koutný Signed-off-by: Chris Down Acked-by: Michal Hocko --- mm/memcontrol.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 0b38b6ad547d..f7cc66a80348 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6416,7 +6416,7 @@ enum mem_cgroup_protection mem_cgroup_protected(struct mem_cgroup *root, if (parent == root) { memcg->memory.emin = READ_ONCE(memcg->memory.min); - memcg->memory.elow = memcg->memory.low; + memcg->memory.elow = READ_ONCE(memcg->memory.low); goto out; } @@ -6428,7 +6428,8 @@ enum mem_cgroup_protection mem_cgroup_protected(struct mem_cgroup *root, atomic_long_read(&parent->memory.children_min_usage))); WRITE_ONCE(memcg->memory.elow, effective_protection(usage, parent_usage, - memcg->memory.low, READ_ONCE(parent->memory.elow), + READ_ONCE(memcg->memory.low), + READ_ONCE(parent->memory.elow), atomic_long_read(&parent->memory.children_low_usage))); out: