Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6847005imu; Mon, 3 Dec 2018 03:56:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/XYZWRJe7QGztPtjhIhuGKba5eCh2JdMf0tEnN/WzsH8QvGDIMqv8N45C+pT5aadO1nRfO3 X-Received: by 2002:a63:fc49:: with SMTP id r9mr12671859pgk.209.1543838159956; Mon, 03 Dec 2018 03:55:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543838159; cv=none; d=google.com; s=arc-20160816; b=zRqO7hFVYMG7hAeWWyyYc1KqPTWBWG2u1d9f1T3q+aOVx+02mFb5/cuT4QYMR5s1u/ 4JCxil5oDbkMsAASBNEEQ1NyjnwIBTEMtaByBLxt3xoo073xYjVnU6O67OXXQToTSZ+2 jkeOvDUHJDfA1Z/SLTdBYxIa2FgPQOrnzEHSq0VuujEN1SYEhQM8wj3M1TqrHN+/GlWm SVouecbc6t4yjGcAV2KsVYGeX6JE5UQmAyN3FNcAa8OPQRC7WMziiChK3h8TO6bpJm/O zptRC9L2HnlDPx6tQQPjXCTiJulXwBvHkV7AriwrC/+GBzKabsdm1ucgBdbmTqbNepzH rlfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=vue5EeZYRKPKXM05nTOBvZNnx3UjATj1iHIFAG6uLkk=; b=WAVMQwHsChp4KE1uCIxcq7Ha3D0NzGs904MMLoRDZKAhbUUd8FgIqeL0zSQlANcZ5L CbF2C3FaFLPwAEROaY977oPvNt+lYM/heLkzJTP348GuCmS/BiR0h+AJrUo2fAoY20dc To3n2KDjX/hT9YNYtRbRad4T42J+HG3MIFPk0ljnHrMlnXFu/bWMoO29SgCxZ3F0mVYY 9h2fRup/OfZS9SdQJCv7nKUsaw+9hu9L0LDUtleYgxNa1TTN2g3wXzbatnpuV63iKzXv g8MkM+pAknZRyA/ELG7mhWTGxE2rnRb/FKhrrWtGnHNoswJJ4c/KMXpuzRoPyLyeaUUS 4wOA== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j28si12299422pgm.160.2018.12.03.03.55.45; Mon, 03 Dec 2018 03:55:59 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726302AbeLCLzk (ORCPT + 99 others); Mon, 3 Dec 2018 06:55:40 -0500 Received: from mx2.suse.de ([195.135.220.15]:59758 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725975AbeLCLzk (ORCPT ); Mon, 3 Dec 2018 06:55:40 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 79AEBAC66; Mon, 3 Dec 2018 11:54:54 +0000 (UTC) Date: Mon, 3 Dec 2018 12:54:53 +0100 From: Michal Hocko To: Xunlei Pang Cc: Roman Gushchin , Johannes Weiner , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/3] mm/memcg: Fix min/low usage in propagate_protected_usage() Message-ID: <20181203115453.GO31738@dhcp22.suse.cz> References: <20181203080119.18989-1-xlpang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181203080119.18989-1-xlpang@linux.alibaba.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 03-12-18 16:01:17, Xunlei Pang wrote: > When usage exceeds min, min usage should be min other than 0. > Apply the same for low. Why? What is the actual problem. > 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) > -- Michal Hocko SUSE Labs