Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp496imu; Thu, 15 Nov 2018 20:43:49 -0800 (PST) X-Google-Smtp-Source: AJdET5euoiQmY4yc4GOh0dk46rLcXVWofGJXPpeTOXkT1AHrW/8/Uv3fJfNwt9sl/Cmf4tVNo1Rl X-Received: by 2002:a17:902:d697:: with SMTP id v23mr9043048ply.261.1542343429637; Thu, 15 Nov 2018 20:43:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542343429; cv=none; d=google.com; s=arc-20160816; b=XTxHWFFOPyuNzkd/fWctLQ2nGItmXCSDNCZ5wyb0U+VLb4A6o4NYuV3ytHY0SyZlEu Kuc3RFybXRbD44gGVtmbSFEXfJPg0ZEctJTMOm8UWem3xfyM25MK1OofYu6XabqI4Dho EuFjkwgiUzeShZHiWHKhw7ONum0mUjUBbTyOHxMKBdR/AR3c7pNNaMkGfCchTuLOTWvv rgN5T0gUHAjSk2Ve0XHkmnX8eANxUyYCtkgisxEbI3EYQ2+jc4UbL10c6DkJ5SbYhf4n Tfh3040MCrxBWzJVqGE8GHNBY5yfdSQdCna6JaEFImti419AfzPhCQKwnuVDTaV51g2a BZwQ== 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=KFL2CePL0CfF7hHpaEzXB2jB74rTdzgga0PowQtfHDM=; b=nxfzWcHVA8Ii6Q2i2rGuYE/8pabuJRz//fm7ZuUygUgKejPd/9ZmkzsFaZiXlGIrJu HiPkxigy050IaAzNPIWeuqN0OGFAEPKiXvcZdErp4FMX9ojclTy2jQneR0yOC0L8T+Wh hkLcR1STe1OlWQo7pktYT3HpJUhsQdiPMSKbyAOxQ0zTblHwFnpnTBkEWl0EuxA8Qzr5 vfZz3PJgVKdEn8lpySU0hHUFqomniVOWQYGQHE7aiq2k4drHbssweEFsiQUlHpvpi5tS ZhbJnLrVdcb6vLvR1uu4ja1uVemHlJdkp8GO0Y9NLooYEEOxs3xImP58B9UC1G4NyBW3 /Qow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rLru68x8; 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 k25si1717605pfe.10.2018.11.15.20.43.32; Thu, 15 Nov 2018 20:43:49 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rLru68x8; 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 S1727410AbeKPOwK (ORCPT + 99 others); Fri, 16 Nov 2018 09:52:10 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:32905 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727272AbeKPOwK (ORCPT ); Fri, 16 Nov 2018 09:52:10 -0500 Received: by mail-ed1-f67.google.com with SMTP id r27so15604707eda.0 for ; Thu, 15 Nov 2018 20:41:21 -0800 (PST) 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=KFL2CePL0CfF7hHpaEzXB2jB74rTdzgga0PowQtfHDM=; b=rLru68x82erNdIf6bZAfSBWT5l97Qz3e24FnvN62gsNkapiwByrLaAmmteo9UxZJTL bld7ZJ4d18pynfiG0p5NMbDK+fSWR3Jb8VF6GyOBueO0SSiC6Dlu5DVjU8ic67UTGBeN 6t6C+rZcy7JyBwcCGcgMvp8L5/Mr8sd6OCvdmXXT55lV9FO6NtTbIfPpRxzbXu8cq4mb cUUEfuZjWrM/TkIzZpY9ghICKMJ8BmUgc0oiRdmdCnG5o8Fnw25+pqt0RecPpA+Ru9hi bc7tZ/fLHEUJToHRnLht/Yt6gZ14NczNhn9fqJpiwvnx9gRIrNm4bVq6/uhEL2yFI72g f3pw== 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=KFL2CePL0CfF7hHpaEzXB2jB74rTdzgga0PowQtfHDM=; b=eeMvwkB1LI58v/CxDat4HnHLrv0K5MguXnOvSf5CkIxrghyiPQoRjb9TAIlc+0mtIO xLiTnVaCou67XbUJkpsDBUcjQViu0w1SsePH0OMpCymp+mN8ACY6BjF2VxsZzWmx4buS vB760PAJXosyw5L+gvPvXDKtRk1O/YO/XrZ3KnAC/d1+Yxwi6BB87ly+397tl6WMo2U5 DSkRvaH8+csGiEsiY1/Z3ESeq/nKzgWBrtPeDwktVwu7XX6UXR59m2MgpRKsqePElbEN 0r47BYN5M00BwMRzzGuALUx3VykogCqawwIsle9/Ti27ogFkmaAZrIbi9ItrCSjXBDgM hK5Q== X-Gm-Message-State: AGRZ1gKmq1b7b8cxrdlQyMp6799o19sNc7xAPBfc4sci/ZA7PhRk7DSF TFjXMNq1vc03LDH54m+KMEI= X-Received: by 2002:a50:b1af:: with SMTP id m44mr7965730edd.47.1542343280934; Thu, 15 Nov 2018 20:41:20 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id y53sm2753315edd.84.2018.11.15.20.41.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 20:41:20 -0800 (PST) Date: Fri, 16 Nov 2018 04:41:19 +0000 From: Wei Yang To: Andrew Morton Cc: Wei Yang , mhocko@suse.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: use managed_zone() for more exact check in zone iteration Message-ID: <20181116044119.evn42acahfl6fh4r@master> Reply-To: Wei Yang References: <20181114235040.36180-1-richard.weiyang@gmail.com> <20181115133735.bb0313ec9293c415d08be550@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181115133735.bb0313ec9293c415d08be550@linux-foundation.org> 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 Thu, Nov 15, 2018 at 01:37:35PM -0800, Andrew Morton wrote: >On Thu, 15 Nov 2018 07:50:40 +0800 Wei Yang wrote: > >> For one zone, there are three digits to describe its space range: >> >> spanned_pages >> present_pages >> managed_pages >> >> The detailed meaning is written in include/linux/mmzone.h. This patch >> concerns about the last two. >> >> present_pages is physical pages existing within the zone >> managed_pages is present pages managed by the buddy system >> >> >From the definition, managed_pages is a more strict condition than >> present_pages. >> >> There are two functions using zone's present_pages as a boundary: >> >> populated_zone() >> for_each_populated_zone() >> >> By going through the kernel tree, most of their users are willing to >> access pages managed by the buddy system, which means it is more exact >> to check zone's managed_pages for a validation. >> >> This patch replaces those checks on present_pages to managed_pages by: >> >> * change for_each_populated_zone() to for_each_managed_zone() >> * convert for_each_populated_zone() to for_each_zone() and check >> populated_zone() where is necessary >> * change populated_zone() to managed_zone() at proper places >> >> Signed-off-by: Wei Yang >> >> --- >> >> Michal, after last mail, I did one more thing to replace >> populated_zone() with managed_zone() at proper places. >> >> One thing I am not sure is those places in mm/compaction.c. I have >> chaged them. If not, please let me know. >> >> BTW, I did a boot up test with the patched kernel and looks smooth. > >Seems sensible, but a bit scary. A basic boot test is unlikely to >expose subtle gremlins. > Agree. >Worse, the situations in which managed_zone() != populated_zone() are >rare(?), so it will take a long time for problems to be discovered, I >expect. Hmm... I created a virtual machine with 4 nodes, which has total 6 populated zones. All of them are different. This is a little bit out of my expactation. > >I'll toss it in there for now, let's see who breaks :( Thanks. -- Wei Yang Help you, Help me