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.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 8EEDDC433E0 for ; Fri, 19 Jun 2020 12:59:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 525A620776 for ; Fri, 19 Jun 2020 12:59:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UI3fLXk4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 525A620776 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E23548D00A0; Fri, 19 Jun 2020 08:59:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DAB3C8D009E; Fri, 19 Jun 2020 08:59:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C70788D00A0; Fri, 19 Jun 2020 08:59:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id 9CDC58D009E for ; Fri, 19 Jun 2020 08:59:41 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6ABC61EE6 for ; Fri, 19 Jun 2020 12:59:41 +0000 (UTC) X-FDA: 76945968162.12.bike90_111432026e19 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id DAE701800BEA9 for ; Fri, 19 Jun 2020 12:59:40 +0000 (UTC) X-HE-Tag: bike90_111432026e19 X-Filterd-Recvd-Size: 3734 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Fri, 19 Jun 2020 12:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592571579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rvOYlxX/ss3he1Lry1x4z3ESe0cJhRvr+Z1vSMlD8Bw=; b=UI3fLXk4UJTADMp/uzSpoVb9FG+MqAVkiOfn8n0Zw4ohyN28H0v+zpKZfQ4zHVb/YhOwBR xIX8JOM36zxRYl3onEEngHonMjDrpusKa9BC00gOOL5ri60E6QZnAHYHRD/WigNbvxa15y iI3RuDMqObpK1PFetJzhHf/ino80yHc= 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-90-Z3v5g7uPPfe9Nx2mtqzgMQ-1; Fri, 19 Jun 2020 08:59:37 -0400 X-MC-Unique: Z3v5g7uPPfe9Nx2mtqzgMQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7DF2B107ACF6; Fri, 19 Jun 2020 12:59:36 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-137.ams2.redhat.com [10.36.113.137]) by smtp.corp.redhat.com (Postfix) with ESMTP id E99F05D9CA; Fri, 19 Jun 2020 12:59:34 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Alexander Duyck , Dan Williams , Michal Hocko Subject: [PATCH v2 2/3] mm/memory_hotplug: document why shuffle_zone() is relevant Date: Fri, 19 Jun 2020 14:59:21 +0200 Message-Id: <20200619125923.22602-3-david@redhat.com> In-Reply-To: <20200619125923.22602-1-david@redhat.com> References: <20200619125923.22602-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Rspamd-Queue-Id: DAE701800BEA9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 Content-Transfer-Encoding: quoted-printable 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: 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 ta= il 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 --- 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 l= ong nr_pages, zone->zone_pgdat->node_present_pages +=3D onlined_pages; pgdat_resize_unlock(zone->zone_pgdat, &flags); =20 + /* + * 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); =20 node_states_set_node(nid, &arg); --=20 2.26.2