Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp30881pxj; Thu, 27 May 2021 20:19:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKUshtgCLRqCNTmgU23bADRrxSLBuwO7acieKjMcGiJ47pJuFrfjC+TCs7ViNRJc3GKKrU X-Received: by 2002:a05:6e02:1b07:: with SMTP id i7mr5646078ilv.121.1622171988992; Thu, 27 May 2021 20:19:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622171988; cv=none; d=google.com; s=arc-20160816; b=TSgVBgaDOq8eab+02LpdRWGfsC8qA2sW1hJI1e+WG8dn2/i78sPts2+KtsrTtgBw81 bIh3UVm6iWLChtCqMIwN6Fq05CBhyD4Ti9Mo6qbsHRsvvCmq1GXsqoY3HbUwFyRECJLK YQLHf31WB0RsMm2ZY/XDFpZk5DoFLc0yATMKBdie7uOeZnzKWhVk1JbW31x9uk9XAt3d 4QpmCCxp+fGRfneKQiV4/LOu7DWQoqypmb254eZGnhDSpoE0o6xM8VG0k1GScsO5DQ2o i19t9oKmdTjaWSNyXzsVeWcywGl6l0vZf63lJiTCNUyAB0XgS8xHvfq+Q/LJaMbWEglz ugAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=9nBjrn2Nu1rup4YX34Bcybft9Ot8nZh9IC/a7KhqVnU=; b=Mzk4tw9uAmfhN6FzJ9MjglDSqhtHOmUSe9Bs6XYZ7rToJVCw855G3iadmX0l6eRuBj 0XwR/G6A7jciZ3P1/gR+VHIHCkqiv4AmSw282hIRA7KYujboBBlGvMzkE4BImDG98ycT 8fyyrNk6zRpobo0JGPYn8zDDmrqj4jE25zHIxue3cMYCji1t1tU9w3SYJamPqD0Sbi5c yt2QRTT9G5uGsP3nA7oS/DVjdYjZCiHu2dcfj20tU3KnGeUXMBCz31bYlhPZUzSAJcvM 0eIdkcBufb7DWxXe8ywr0FgVJGaIvWUvSxhV3NVU85WTwqPRBgE8gFi1LCkYP2UhxMev CoAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RStS3Dw8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o67si4824287jao.17.2021.05.27.20.19.15; Thu, 27 May 2021 20:19:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RStS3Dw8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236597AbhE0Xtb (ORCPT + 99 others); Thu, 27 May 2021 19:49:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20320 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236603AbhE0Xta (ORCPT ); Thu, 27 May 2021 19:49:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622159276; 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=RStS3Dw85vYb+wrFqATu8W6RaXDyKVzTP56lpSjvNc3gJwj+UhEN8zVEESu3bqtb5o1JOr km/nfzP8NDlNv/ww5On/B4ymOFGQZzdxFCHDN0sDcQtpQc6aOSdRa7hkTLvdPDsxscFgUL aadCaoN5rfIoCYftcc/VsoZqV2/tAiU= 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > >