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=-7.0 required=3.0 tests=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 40DFAC433E0 for ; Mon, 22 Jun 2020 15:32:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0227920732 for ; Mon, 22 Jun 2020 15:32:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0227920732 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9B4216B0006; Mon, 22 Jun 2020 11:32:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 964F76B0007; Mon, 22 Jun 2020 11:32:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 853AA6B0008; Mon, 22 Jun 2020 11:32:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 696846B0006 for ; Mon, 22 Jun 2020 11:32:55 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 0E281807BF55 for ; Mon, 22 Jun 2020 15:32:55 +0000 (UTC) X-FDA: 76957240710.27.top17_5c03d3a26e33 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id CD6FD9E522 for ; Mon, 22 Jun 2020 15:32:42 +0000 (UTC) X-HE-Tag: top17_5c03d3a26e33 X-Filterd-Recvd-Size: 4363 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Mon, 22 Jun 2020 15:32:42 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id l17so20850wmj.0 for ; Mon, 22 Jun 2020 08:32:42 -0700 (PDT) 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:references :mime-version:content-disposition:in-reply-to; bh=cAmfTEzP0A9GNdwX1CUxrRImn2sCx7fggd7uZBD9QAA=; b=ARaWVUoZ3OoMW4fyYp0wn4pVCp84xHrDg9wfTjg53Z7Bw47r4YEFIhCDSgFc9bhOME lARtlnyU1vCOityhmYkIWZG1343Ium+GHDegd9z+cRhejk4DGjgvMQIetenCKTDLxGY9 Pbcvjwl3MFhbv53EQ6ewsxU0AnS6fGJk+skDoi2izgqM6AmwV2/NS2lE5Yd0DEX5nk8Y c1o8BW/DUy+3Hkp1N9boXB4esC4y9jryFdVATSIJUVNqx3nNafC34rv6vtH6Ej3rRc0h yvAqTxEOv6HLRMCITC8uzOCN1avMw+AX1ZigFFxEnTseeby9Y0EjAu6E8CYwmRIW3EFS +bwA== X-Gm-Message-State: AOAM533DQfKuSBVcxXVQfLD9b4yNnZd1WiaHzl93jQkc7cxeIQJvvP2h CsVk3sXsX38RlOi/9JuCGfA= X-Google-Smtp-Source: ABdhPJzP8YZhJJPd4r+UmJWVfWlzkqb3q+8tOhqk11fPZAfOjSka8ewnXJMWnWM/11eoh6hPIfxMrg== X-Received: by 2002:a7b:c3d0:: with SMTP id t16mr17906944wmj.117.1592839961302; Mon, 22 Jun 2020 08:32:41 -0700 (PDT) Received: from localhost (ip-37-188-173-135.eurotel.cz. [37.188.173.135]) by smtp.gmail.com with ESMTPSA id t188sm17714258wmt.27.2020.06.22.08.32.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 08:32:40 -0700 (PDT) Date: Mon, 22 Jun 2020 17:32:39 +0200 From: Michal Hocko To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Alexander Duyck , Dan Williams Subject: Re: [PATCH v2 2/3] mm/memory_hotplug: document why shuffle_zone() is relevant Message-ID: <20200622153239.GH31426@dhcp22.suse.cz> References: <20200619125923.22602-1-david@redhat.com> <20200619125923.22602-3-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200619125923.22602-3-david@redhat.com> X-Rspamd-Queue-Id: CD6FD9E522 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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 19-06-20 14:59:21, 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. > > Cc: Andrew Morton > Cc: Alexander Duyck > Cc: Dan Williams > Cc: Michal Hocko > Signed-off-by: David Hildenbrand OK, this is an improvement. I would still prefer to have this claim backed by some numbers but it seems we are not going to get any so we can at least pretend to try as hard as possible especially when this is not a hot path. Acked-by: Michal Hocko > --- > 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. > + * 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); > -- > 2.26.2 -- Michal Hocko SUSE Labs