From patchwork Mon Dec 3 08:01:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xunlei Pang X-Patchwork-Id: 10708723 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1768E13BF for ; Mon, 3 Dec 2018 08:01:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C03D2ADE2 for ; Mon, 3 Dec 2018 08:01:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A5582ADE9; Mon, 3 Dec 2018 08:01:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9405E2ADE2 for ; Mon, 3 Dec 2018 08:01:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B1066B6803; Mon, 3 Dec 2018 03:01:38 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 937676B6804; Mon, 3 Dec 2018 03:01:38 -0500 (EST) 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 801C16B6805; Mon, 3 Dec 2018 03:01:38 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by kanga.kvack.org (Postfix) with ESMTP id 460666B6803 for ; Mon, 3 Dec 2018 03:01:38 -0500 (EST) Received: by mail-pl1-f199.google.com with SMTP id a10so9628678plp.14 for ; Mon, 03 Dec 2018 00:01:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=c4Qv9Gm3O0+AcCdsYZx4NZiPFV4kztTlVCRvfv2cNgU=; b=npqfQcI48dLC+nqjAcEAbU8C+lUvUWDmzCxE7oZM/WX04EVLOzIskA6Z6tsE6qWxsM ndwTUB6XaQZ11wlbetw77NcSRs55LGXCioenm5+G18UyujdnTUWleFUX5+UIQghuddBs oMbK9RU5irqNr8GJ9tmwpayo8F/QWteYt+cBeCvGuqeKSRJC7b1vRLgdJxU8VffaHZZt /2GZiPm430rSROkdfcp+z4CrLFBATVT1FBDUo421yKujEJJ4UYNp2YHL+qC0Q9hkWZdn NVvQV3yWd2r+dRtsY6s5kuXxjgRpZCNdQQz9PMZEECfeygCoAGX3mf/1UD1UPB4lrlgR pFJA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of xlpang@linux.alibaba.com designates 47.88.44.37 as permitted sender) smtp.mailfrom=xlpang@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Gm-Message-State: AA+aEWYZTXS/vRHpa9FEzkjDEVX80G9BEy17gLF8F70lUEMk4QMRzJ+L o2R4BHg/xl/pw0aULPhF2SB9DXUwVtr7KAsMTA+CUmvXELcdzQq6pYDhEXzIdr4oRsT81QhvjeO sDtCO3gyOQxfG3vlLS5nGj9PUhxODlHRmyq59b0aRubz6B34t3qEjuKE+a+ZtppxVvg== X-Received: by 2002:aa7:8286:: with SMTP id s6mr14561140pfm.63.1543824097963; Mon, 03 Dec 2018 00:01:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/U2wUJL9NjuUGbYkV0b+NNxg7Ge2SpmboasTT07qmCGyxaSJacvsZDM7oF5C+RyoyRvYEJB X-Received: by 2002:aa7:8286:: with SMTP id s6mr14561083pfm.63.1543824097044; Mon, 03 Dec 2018 00:01:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543824097; cv=none; d=google.com; s=arc-20160816; b=Hr3AJbWVzquzi7JDSJTXEYCXCCamMN3ne2YJoDsUxxgkvZ30P7G0Yxk+ixg2gsxRPL wnwI8/V7qflm6kZBXh2uTu+7Y7UTuMcnwDP2CWxkpA09H5r2Rogp/1Oq+wdGw2RqsYHp JftoKGmWyQ10MHOkxLEGg5nn3cmolBUHw9NXCa5lysEvln5AWK5LjNqtbVMbGenHBNjJ T4pDKWhFZROVKr+nN0V0PqNP0TtLQLVFSl74UCM4DI13DAlIo17llU9+s5cuIsLfynpl VSehbL1HHKuXLRZMEfYj5b+pkM/kSUbSKCorgViGjzXv4F9mpIA61VIiPVman7piRx5Y T3fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=c4Qv9Gm3O0+AcCdsYZx4NZiPFV4kztTlVCRvfv2cNgU=; b=w8PWVfjKBRLBoB5mj+Mw6kPwZXhTkey/T7SzZLvwicMAH1Yuf9AWtU1tz3cjX9o/kK QrTo6YUWgsuJhCxw3W4iV5x+7PPyKESP097V7idWvrPPB1dumjeieIpyoiEQVDZaAOyu EpTQOfxgo6x9ii3uhIfvK9rD+W3g2RLS/wKPicCW+IQXwyv4lgxqdFfAk0ESO3c4uHbP ndxxffksqlaYFqgsEg3pA9UNlfNdCkEhU5ZKZ3OitlhxEe+afmIQSnSo31vd88Q9cB1X 24ZeDrXAXJNH0LIYQKv/UwKfUoN3euxO0CjHyn2luuEh/Jw5CJZYMnWZvNyGw+nT4bfk n0iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of xlpang@linux.alibaba.com designates 47.88.44.37 as permitted sender) smtp.mailfrom=xlpang@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out4437.biz.mail.alibaba.com (out4437.biz.mail.alibaba.com. [47.88.44.37]) by mx.google.com with ESMTPS id g6si11884244pgn.57.2018.12.03.00.01.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Dec 2018 00:01:37 -0800 (PST) Received-SPF: pass (google.com: domain of xlpang@linux.alibaba.com designates 47.88.44.37 as permitted sender) client-ip=47.88.44.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of xlpang@linux.alibaba.com designates 47.88.44.37 as permitted sender) smtp.mailfrom=xlpang@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.002030, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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)