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=-6.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 95A4CC433E0 for ; Sat, 20 Jun 2020 01:41:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4ACDD22CAD for ; Sat, 20 Jun 2020 01:41:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="YXI2uDsx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4ACDD22CAD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D4F588D0003; Fri, 19 Jun 2020 21:41:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D00B56B0096; Fri, 19 Jun 2020 21:41:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C16428D0003; Fri, 19 Jun 2020 21:41:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0222.hostedemail.com [216.40.44.222]) by kanga.kvack.org (Postfix) with ESMTP id A719B6B0095 for ; Fri, 19 Jun 2020 21:41:34 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3D006181AC9CC for ; Sat, 20 Jun 2020 01:41:34 +0000 (UTC) X-FDA: 76947888108.03.river82_5b0368e26e1d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 17E0F28A4E8 for ; Sat, 20 Jun 2020 01:41:34 +0000 (UTC) X-HE-Tag: river82_5b0368e26e1d X-Filterd-Recvd-Size: 4891 Received: from mail-ej1-f65.google.com (mail-ej1-f65.google.com [209.85.218.65]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Sat, 20 Jun 2020 01:41:33 +0000 (UTC) Received: by mail-ej1-f65.google.com with SMTP id gl26so12202109ejb.11 for ; Fri, 19 Jun 2020 18:41:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cGEKlCMwGCVdgAUnlLlbikbWphYIp6lmyRBiC34xvQY=; b=YXI2uDsxPIP5ikjSuPaoUIF1ub+ItyOscirT0PZX6vg5+S9mPCXhIixyDfmWkUXF2/ bGtT5MMsoK0KB1oN0FS8bAWiBHLJ1TJxoaObYThsr4ACcF60AupjpzkMEv2DkySF+2jw i7DfE/dF8LfVQjnLlxhyGdB5uOX+JY9BocyLkq5YyVyc0ywIsmTqEeVLfBY1j0mX/OSN pMRU14+JMtSgP4f8ozG7j4PTKh/+YOWGGfTITRSDNwPDd3PbAaOBVHW8LGNrKljVIAzA tBftNKW/7zWcmS70mDCjWpXQjCQPSqayKz3jfPbC301Xf4J4YO+tZJyxuO/dJszlk9m0 xwzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cGEKlCMwGCVdgAUnlLlbikbWphYIp6lmyRBiC34xvQY=; b=Q/GU7n8HUiHgJWd2/lI68VEjckBOjDuvbtLDt10i4gDTjTE9HKMaG5UETgjYiWiDFf zniqG8rBAMJ4LPPfvxN/xb2RQyNfK2IcLfIPndd3zAoVM3YgqVxKd51KlRV511Q4ObHj eED8d0AjABbk2na7WpBNimwAywv4VmH9yoA8BN6lOo07a+SVpEC+yGfameWsZAR70+pH tU2oH+w5bmNsBNe4eMiTOyygQXye0nG9y7rZwgeLo19rYWSu2RBc6hO/BoyEA2AauuHC ++T8YeO/aaONm8+jk6srFGJQNqmZ+u01Ylqf11oT/apNls5pkRWSYTpok4QyMqU3D9/7 WozA== X-Gm-Message-State: AOAM530GzeUXNrZuXkjYo8U8tye6UdrgDwit1zWmGVH2S0/mMhabwMa0 auj6zpoWB7fPsa5G5D67BSrXggeEWCCL9qQaQeHyBg== X-Google-Smtp-Source: ABdhPJymAe1wIbRyau9RlQ6rtHNZw5DceIsixBfHh6SSvyh/IXmUxdYQl3Gloshx2qUoNe5r4vkQUkPYAmNv0UbeP2s= X-Received: by 2002:a17:906:fac8:: with SMTP id lu8mr6018617ejb.432.1592617292159; Fri, 19 Jun 2020 18:41:32 -0700 (PDT) MIME-Version: 1.0 References: <20200619125923.22602-1-david@redhat.com> <20200619125923.22602-3-david@redhat.com> In-Reply-To: <20200619125923.22602-3-david@redhat.com> From: Dan Williams Date: Fri, 19 Jun 2020 18:41:21 -0700 Message-ID: Subject: Re: [PATCH v2 2/3] mm/memory_hotplug: document why shuffle_zone() is relevant To: David Hildenbrand Cc: Linux Kernel Mailing List , Linux MM , Andrew Morton , Alexander Duyck , Michal Hocko Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 17E0F28A4E8 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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 Fri, Jun 19, 2020 at 6:00 AM David Hildenbrand wrote: > > It's not completely obvious why we have to shuffle the complete zone, as > some sort of shuffling is already performed when onlining pages via > __free_one_page(), placing MAX_ORDER-1 pages either to the head or the tail > of the freelist. Let's document why we have to shuffle the complete zone > when exposing larger, contiguous physical memory areas to the buddy. > How about? Fixes: e900a918b098 ("mm: shuffle initial free memory to improve memory-side-cache utilization") ...just like Patch1 since that original commit was missing the proper commentary in the code? > Cc: Andrew Morton > Cc: Alexander Duyck > Cc: Dan Williams > Cc: Michal Hocko > Signed-off-by: David Hildenbrand > --- > mm/memory_hotplug.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index 9b34e03e730a4..a0d81d404823d 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -822,6 +822,14 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, > zone->zone_pgdat->node_present_pages += onlined_pages; > pgdat_resize_unlock(zone->zone_pgdat, &flags); > > + /* > + * When exposing larger, physically contiguous memory areas to the > + * buddy, shuffling in the buddy (when freeing onlined pages, putting > + * them either to the head or the tail of the freelist) is only helpful > + * for mainining the shuffle, but not for creating the initial shuffle. s/mainining/maintaining/ > + * Shuffle the whole zone to make sure the just onlined pages are > + * properly distributed across the whole freelist. > + */ > shuffle_zone(zone); > > node_states_set_node(nid, &arg); Other than the above minor fixups you can add: Acked-by: Dan Williams