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.8 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 F1B68C433DF for ; Wed, 24 Jun 2020 09:47:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B773A20885 for ; Wed, 24 Jun 2020 09:47:59 +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="izWOeL0N" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B773A20885 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 5FF6B6B000D; Wed, 24 Jun 2020 05:47:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B1AD6B000E; Wed, 24 Jun 2020 05:47:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47B6A6B0010; Wed, 24 Jun 2020 05:47:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0234.hostedemail.com [216.40.44.234]) by kanga.kvack.org (Postfix) with ESMTP id 2A8646B000D for ; Wed, 24 Jun 2020 05:47:59 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E685A68A2 for ; Wed, 24 Jun 2020 09:47:58 +0000 (UTC) X-FDA: 76963629036.15.son86_630ff8626e43 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id B8B511814B0C1 for ; Wed, 24 Jun 2020 09:47:58 +0000 (UTC) X-HE-Tag: son86_630ff8626e43 X-Filterd-Recvd-Size: 3948 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Wed, 24 Jun 2020 09:47:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592992077; 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=As/RiLcx3QSCT66IiodQttbgWQYDaA6eF3/r4/FuBjM=; b=izWOeL0NvuAtkxTvdCeicn1Paf3ZqmpIeZpxn1o2km0nmD+7pTY+I6OxyWo/yKuUfjYiGV vtEkPkZ1ivsnvkrmXAhmkZtbzsB6MZ4RjwYtF6UpW7F23+CsLjRcGkB7h1xguVQqzzyuXY y+y1j9VlVXsCnJLcVLBiiClPdwing4g= 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-267-8IxozmEVPvCQQSRranh35g-1; Wed, 24 Jun 2020 05:47:54 -0400 X-MC-Unique: 8IxozmEVPvCQQSRranh35g-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 88982188360B; Wed, 24 Jun 2020 09:47:52 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-65.ams2.redhat.com [10.36.113.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E3CD1017E27; Wed, 24 Jun 2020 09:47:50 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Dan Williams , Michal Hocko , Andrew Morton , Alexander Duyck Subject: [PATCH v3 2/3] mm/memory_hotplug: document why shuffle_zone() is relevant Date: Wed, 24 Jun 2020 11:47:40 +0200 Message-Id: <20200624094741.9918-3-david@redhat.com> In-Reply-To: <20200624094741.9918-1-david@redhat.com> References: <20200624094741.9918-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Rspamd-Queue-Id: B8B511814B0C1 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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 - introduced in commit e900a918b098 ("mm: shuffle initial free memory to improve memory-side-cache utilization") - because 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. Acked-by: Dan Williams Acked-by: Michal Hocko 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 be3c62e3fb95c..ac6961abaa103 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -831,6 +831,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 maintaining 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