Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6651137imu; Mon, 3 Dec 2018 00:02:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/XPLsZvdAD/NQBPEqCg68vNwCvDqdklVsli5pa6mm68+ukulJB+ftyUPWTG2oYwsAFmIQfF X-Received: by 2002:a63:f811:: with SMTP id n17mr12775848pgh.23.1543824160952; Mon, 03 Dec 2018 00:02:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543824160; cv=none; d=google.com; s=arc-20160816; b=MQ8S38k8f43ONnnxAEPmtEg4WzU++kLbZH4KiQFBbtpRSNQKORKv7pTqRu9mHHhwK8 itrhHplIeNq/1Ar1I7XfXYLZKEBv6plqnCvA5sAn5Dnh0KObAPaQbrSAJGjul4JTu6mZ 0V/VJtLLNDSKOwWXs05iQqWCqJ6EHdsuYlMeQnA8xW4TWDN2IrEciI6Vmm7QlPAVbJVO QUi1lPYz/0Q35YC0+6cTLj+/8Y1rWrRkRNgUOvO7e8g4jA/GRD0pkGHQ7iW4UTD6S+n3 Ejqr7BSqoQTXDx//DA/IhBroCIDLys5cyfsxUml+ParX3dM2yIV2cB7Oj8v2AUqAMm7x vl+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=c4Qv9Gm3O0+AcCdsYZx4NZiPFV4kztTlVCRvfv2cNgU=; b=M8ej322aW25HfhEg7zJV4TC7y6hJaOm4ERa56CWpOiBCPoMNN/cje/qC6f+9hwabF3 RFroecvkFlkX9H1BQoc0b4q+X1nvtE7+DHxWvk5bW5OWXPpuwLsdxsFSHjEQk4s2ln6i Ht5xEsZUXpqkqCUqU9jjFo3lOza9xkI4hQbuKG86r40vecKBizgtClj/+Op88tBZCzBq JjNco3r+qDJaifoeLwQSadSoxw/kF3WwNL6U6BXlDid6mayq1ERHl/NSgEELZNmTQoaN GoXLeLm0emTyD/LvvRFubaeBCF121OnXcMDc10wm+LVxKX7ZCdP2pODfjf+7rsuBCuv0 YSZg== ARC-Authentication-Results: i=1; mx.google.com; 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=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si11081274pgm.216.2018.12.03.00.02.26; Mon, 03 Dec 2018 00:02:40 -0800 (PST) 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; 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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725948AbeLCIB0 (ORCPT + 99 others); Mon, 3 Dec 2018 03:01:26 -0500 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:51269 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725941AbeLCIBZ (ORCPT ); Mon, 3 Dec 2018 03:01:25 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=xlpang@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0TEiqOm6_1543824079; Received: from localhost(mailfrom:xlpang@linux.alibaba.com fp:SMTPD_---0TEiqOm6_1543824079) by smtp.aliyun-inc.com(127.0.0.1); Mon, 03 Dec 2018 16:01:20 +0800 From: Xunlei Pang To: Michal Hocko , Roman Gushchin , Johannes Weiner Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/3] mm/memcg: Fix min/low usage in propagate_protected_usage() Date: Mon, 3 Dec 2018 16:01:17 +0800 Message-Id: <20181203080119.18989-1-xlpang@linux.alibaba.com> X-Mailer: git-send-email 2.14.4.44.g2045bb6 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When usage exceeds min, min usage should be min other than 0. Apply the same for low. Signed-off-by: Xunlei Pang --- mm/page_counter.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/mm/page_counter.c b/mm/page_counter.c index de31470655f6..75d53f15f040 100644 --- a/mm/page_counter.c +++ b/mm/page_counter.c @@ -23,11 +23,7 @@ static void propagate_protected_usage(struct page_counter *c, return; if (c->min || atomic_long_read(&c->min_usage)) { - if (usage <= c->min) - protected = usage; - else - protected = 0; - + protected = min(usage, c->min); old_protected = atomic_long_xchg(&c->min_usage, protected); delta = protected - old_protected; if (delta) @@ -35,11 +31,7 @@ static void propagate_protected_usage(struct page_counter *c, } if (c->low || atomic_long_read(&c->low_usage)) { - if (usage <= c->low) - protected = usage; - else - protected = 0; - + protected = min(usage, c->low); old_protected = atomic_long_xchg(&c->low_usage, protected); delta = protected - old_protected; if (delta) -- 2.13.5 (Apple Git-94)