Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2290875ybi; Sun, 9 Jun 2019 08:11:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwY4muydPI0NsTj1qKZ6Jiy2ZjuL5VGdUNDaGWivCLNmYCJG9TnPqWiQ+tbEw6M/4lbTkWQ X-Received: by 2002:a17:90a:7147:: with SMTP id g7mr16680230pjs.42.1560093084265; Sun, 09 Jun 2019 08:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560093084; cv=none; d=google.com; s=arc-20160816; b=wl4SrtPdht1CUrfBL4iC2fdWZHoB16bSbzDwk5aodJrRZSLJCZsRuhm5mn+4R7YGLR fc+M9Pwi1iFrlF6BQMM9vOSsvUJVwj3HKloy2g5FkRUHbod7mmRA507qoshmsmOIMDui T1OR5IkTxq51FaebgQC2uGzdc2ouwtVx353EWJ7eUQGhLQD5ZGYcBB99Wv0c3z/hhmtx WHLRCCiOHmzt7pBpRGdD7Ac1U8zrfUwuW1bqEODgLQGqb3OSmTcSVXCfpiev6cXXK3ca ZghUFTFbobNTJbm8scdQNPsdhFBz/zFEtkTX27GwrdXGUS5K3V7KVxoOrPYwKaSeIHU1 3kDg== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=1qNdnBxzQ1sxPLfepsayWvIRtgHis1fEHl61OHimm90=; b=tpWj2a2FcN08fCuRjsB8iL56SZzPzhdoCJxNIUTJTDElH9XKHSVH5zzrEm7rDDSiGD yHHWyva6o68HuYIs+mwhenwS0/I2BFXZ5z9MOFzCzT87rdiRQl4i/dilK9bdztODSr6m BGsoYpK1ABNUB+vGJbYxTW+uAxEh0n1XHIqXGdxPfPy/SOoDzQB9ouHAo20CphRnuHIM VbITbuk8Em43t5eeTTh0sGUIyuJTV5PZJZY4y16smAhELfSRnKdz58JDefZYvZccGkZN Qj0BFJnizNU/s7TrcE3+SCinzMDOdyyEVpGU8cPYE0xaEstpSUYeCapVPemcYw8oozcG A4VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TW4V5sXz; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n26si7479005pgv.264.2019.06.09.08.10.56; Sun, 09 Jun 2019 08:11:24 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TW4V5sXz; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728808AbfFIOxj (ORCPT + 99 others); Sun, 9 Jun 2019 10:53:39 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:40431 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727500AbfFIOxj (ORCPT ); Sun, 9 Jun 2019 10:53:39 -0400 Received: by mail-ed1-f67.google.com with SMTP id k8so9114477eds.7 for ; Sun, 09 Jun 2019 07:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1qNdnBxzQ1sxPLfepsayWvIRtgHis1fEHl61OHimm90=; b=TW4V5sXzdBVgH5DT3NU7dehMs7b9QS54DmeQvAWdt7RcWFRca8ZYHjqYYm8Z4gxzrT qkMe7MjtwR5yj158Llt6gg9NPtkyL5EXV3lFx0thDKbEdEZjjYf4/iuI5KKImi9iuBfJ qaBANa+HUY8ZtO4fhNyPGW9atPAR9xPuklJOMTim1DYPWYhzmqubIGQOIymVFKu0RXyG rxV6uc/0v73XKetD8Ca6M7FFRRhpYahmSym6XD5JJJoKSo+z7dP8OUadbag28tEQeLGM GCXWmAEiBBaUU7PaED6QGBk69ILS3dI5UYzuro79KWFCpmm2VqCFsIke2Z/fBMtq79Fz Ljlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=1qNdnBxzQ1sxPLfepsayWvIRtgHis1fEHl61OHimm90=; b=QC9aXBvX9iI5MmXra/VNDxM52DnmTRGNuEquKVzm2QC6kE98ORMxz8tydvsYzowdIL lQ08smxQHVTVQSsxUfV+GvK1cZ7vmREmiHvaZhu1/NDFikDTBgATHkH5y573ZE3HBwYe 7k1s/rCLOc0ontBjfvW9xetvqIWZmp+VrVlIpYXZ8WsdOBEheYzs46NvbsFhCkwLXjkI 0OwD8umuZ3vBApxaJcldmKf41rN3naA+JD1m2IfQQWSDB+t/cPNWX6dA8KWOHQdgJhz4 +jXxPutmQDSSJrpbYSW3npaP2kJ6W2p2I8UnC2EyRK+kNUm52/AbhfGLPkmrBxTRBCkC t5Og== X-Gm-Message-State: APjAAAXfGHBVZl8zHyaETMqc4rZYQPaSFAVD8PKlHbEW6KbpNtNOlFU2 y8HbPjlUoAxKega6YsgfT9A= X-Received: by 2002:a17:906:ca9:: with SMTP id k9mr49364733ejh.4.1560092017397; Sun, 09 Jun 2019 07:53:37 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id t54sm2193349edd.17.2019.06.09.07.53.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jun 2019 07:53:36 -0700 (PDT) Date: Sun, 9 Jun 2019 14:53:35 +0000 From: Wei Yang To: ChenGang Cc: akpm@linux-foundation.org, mhocko@suse.com, vbabka@suse.cz, osalvador@suse.de, pavel.tatashin@microsoft.com, mgorman@techsingularity.net, rppt@linux.ibm.com, richard.weiyang@gmail.com, alexander.h.duyck@linux.intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: align up min_free_kbytes to multipy of 4 Message-ID: <20190609145335.yzx4irt4mczmlvno@master> Reply-To: Wei Yang References: <1560071428-24267-1-git-send-email-cg.chen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1560071428-24267-1-git-send-email-cg.chen@huawei.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 09, 2019 at 05:10:28PM +0800, ChenGang wrote: >Usually the value of min_free_kbytes is multiply of 4, >and in this case ,the right shift is ok. >But if it's not, the right-shifting operation will lose the low 2 bits, But PAGE_SHIFT is not always 12. >and this cause kernel don't reserve enough memory. >So it's necessary to align the value of min_free_kbytes to multiply of 4. >For example, if min_free_kbytes is 64, then should keep 16 pages, >but if min_free_kbytes is 65 or 66, then should keep 17 pages. > >Signed-off-by: ChenGang >--- > mm/page_alloc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/mm/page_alloc.c b/mm/page_alloc.c >index d66bc8a..1baeeba 100644 >--- a/mm/page_alloc.c >+++ b/mm/page_alloc.c >@@ -7611,7 +7611,8 @@ static void setup_per_zone_lowmem_reserve(void) > > static void __setup_per_zone_wmarks(void) > { >- unsigned long pages_min = min_free_kbytes >> (PAGE_SHIFT - 10); >+ unsigned long pages_min = >+ (PAGE_ALIGN(min_free_kbytes * 1024) / 1024) >> (PAGE_SHIFT - 10); In my mind, pages_min is an estimated value. Do we need to be so precise? > unsigned long lowmem_pages = 0; > struct zone *zone; > unsigned long flags; >-- >1.8.5.6 -- Wei Yang Help you, Help me