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.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 C4B08C433E0 for ; Mon, 1 Mar 2021 08:36:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 924F164DEF for ; Mon, 1 Mar 2021 08:36:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233203AbhCAIgK (ORCPT ); Mon, 1 Mar 2021 03:36:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:50419 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233169AbhCAIdw (ORCPT ); Mon, 1 Mar 2021 03:33:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614587545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fFrnFRkq8zlLi/GoDu8cq0p/6I3M8mJKkFwM0TB0eXo=; b=EegYYjKDucrudTv7o0ga2WzJ8JBqfIX35cieJz8XVcC/+b7Rh3JA0ysaOQw7HocXvDtcFt MnaPYRjc3zsOB0xBK2O4p6PX/4i8OWfnhQWu4Ip9PIoLDmzy0phBElSCuOYxbNZo4C9Nkf q6/ieWw7U0AHFcVQ8NnoiVwKJPVXsms= 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-590-cNgmDk-fN5Wc8KFNqfl87g-1; Mon, 01 Mar 2021 03:32:23 -0500 X-MC-Unique: cNgmDk-fN5Wc8KFNqfl87g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 57BDE107ACE8; Mon, 1 Mar 2021 08:32:22 +0000 (UTC) Received: from [10.36.114.87] (ovpn-114-87.ams2.redhat.com [10.36.114.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C2A346; Mon, 1 Mar 2021 08:32:20 +0000 (UTC) Subject: Re: [PATCH v2 1/7] mm,memory_hotplug: Allocate memmap from the added memory range To: Oscar Salvador Cc: Andrew Morton , Michal Hocko , VlastimilBabkavbabka@suse.cz, pasha.tatashin@soleen.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Anshuman Khandual References: <20210209133854.17399-1-osalvador@suse.de> <20210209133854.17399-2-osalvador@suse.de> <60afb5ca-230e-265f-9579-dac66a152c33@redhat.com> <20210228185044.GA3929@localhost.localdomain> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <46cd8850-4f6f-6162-474a-a70fc0903cc9@redhat.com> Date: Mon, 1 Mar 2021 09:32:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210228185044.GA3929@localhost.localdomain> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>> + (*online_page_callback)(pfn_to_page(pfn), pageblock_order); >>> + pfn += 1 << pageblock_order; >> >> pfn += pageblock_nr_pages; >> >> Can you add a comment why we can be sure that we are off by a single pageblock? What about s390x where a MAX_ORDER_NR_PAGES == 4 * pageblock_nr_pages? >> >> Would it make thing simpler to just do a >> >> while (!IS_ALIGNED(pfn, MAX_ORDER_NR_PAGES)) { >> (*online_page_callback)(pfn_to_page(pfn), 0); >> pfn++; >> } > > Honestly, I did not spend much time thinking on other platforms other > than arm64/x86_64. > But I think that that would be the universal solution as we do not make > any assumptions. > > I will replace it. I think you can safely go with while (!IS_ALIGNED(pfn, MAX_ORDER_NR_PAGES)) { (*online_page_callback)(pfn_to_page(pfn), pageblock_order); pfn += pageblock_nr_pages; } and maybe add before the loop VM_BUG_ON(!IS_ALIGNED(pfn, pageblock_nr_pages)); as help for the reader that this always holds. -- Thanks, David / dhildenb