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=-17.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 36F89C47089 for ; Thu, 27 May 2021 23:48:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BC389613EB for ; Thu, 27 May 2021 23:48:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC389613EB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3C67A6B006C; Thu, 27 May 2021 19:48:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 375D96B006E; Thu, 27 May 2021 19:48:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 219478D0001; Thu, 27 May 2021 19:48:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0225.hostedemail.com [216.40.44.225]) by kanga.kvack.org (Postfix) with ESMTP id E08EC6B006C for ; Thu, 27 May 2021 19:47:59 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8223EB7B3 for ; Thu, 27 May 2021 23:47:59 +0000 (UTC) X-FDA: 78188651478.30.643A552 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 9CF3D4142C75 for ; Thu, 27 May 2021 23:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622159278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9nBjrn2Nu1rup4YX34Bcybft9Ot8nZh9IC/a7KhqVnU=; b=SbD4bagG/NPHZ4igTQU147sZ/m46cnMJdhWfSmFcjUO6wViaJTP/c8hoOJq/ZuivWtvWpj qZ8747k0wv4lKaKgmc8dlNWbys/39kRw+S++tfLHqHthnS8a7u/d76mnqAINcBiqJSfe5N /ZepnpkT5qoDWAHpRVKeTWPQzE1tQmw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-174-ChZNmBx4NlquyKHweb1k6w-1; Thu, 27 May 2021 19:47:55 -0400 X-MC-Unique: ChZNmBx4NlquyKHweb1k6w-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F3DA1188E3C9; Thu, 27 May 2021 23:47:53 +0000 (UTC) Received: from localhost (ovpn-12-44.pek2.redhat.com [10.72.12.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 35CF95B686; Thu, 27 May 2021 23:47:52 +0000 (UTC) Date: Fri, 28 May 2021 07:47:50 +0800 From: Baoquan He To: Liu Shixin Cc: Andrew Morton , yangerkun , Kefeng Wang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/page_alloc: fix counting of managed_pages Message-ID: <20210527234750.GB31898@MiWiFi-R3L-srv> References: <20210527125707.3760259-1-liushixin2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210527125707.3760259-1-liushixin2@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Rspamd-Queue-Id: 9CF3D4142C75 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SbD4bagG; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf02.hostedemail.com: domain of bhe@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=bhe@redhat.com X-Rspamd-Server: rspam03 X-Stat-Signature: 4wo8f4upym1urf9bjx86b8kqorqudd5b X-HE-Tag: 1622159274-423322 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: On 05/27/21 at 08:57pm, Liu Shixin wrote: > The commit f63661566fad (mm/page_alloc.c: clear out zone->lowmem_reserve[] > if the zone is empty) clear out zone->lowmem_reserve[] if zone is empty. > But when zone is not empty and sysctl_lowmem_reserve_ratio[i] is set to zero, > zone_managed_pages(zone) is not counted in the managed_pages either. This is > inconsistent with the description of lowmen_reserve, so fix it. Right, this is a good catch. Thanks for the fixing. Is it worth adding words in Documentation/admin-guide/sysctl/vm.rst to notice this? Reviewed-by: Baoquan He Thanks Baoquan > > Fixes: f63661566fad ("mm/page_alloc.c: clear out zone->lowmem_reserve[] if the zone is empty") > Reported-by: yangerkun > Signed-off-by: Liu Shixin > --- > mm/page_alloc.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index aaa1655cf682..49a2efce5a84 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -8061,14 +8061,14 @@ static void setup_per_zone_lowmem_reserve(void) > unsigned long managed_pages = 0; > > for (j = i + 1; j < MAX_NR_ZONES; j++) { > - if (clear) { > - zone->lowmem_reserve[j] = 0; > - } else { > - struct zone *upper_zone = &pgdat->node_zones[j]; > + struct zone *upper_zone = &pgdat->node_zones[j]; > + > + managed_pages += zone_managed_pages(upper_zone); > > - managed_pages += zone_managed_pages(upper_zone); > + if (clear) > + zone->lowmem_reserve[j] = 0; > + else > zone->lowmem_reserve[j] = managed_pages / ratio; > - } > } > } > } > -- > 2.18.0.huawei.25 > >