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 2C307C433E6 for ; Mon, 1 Mar 2021 08:30:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B9CE860202 for ; Mon, 1 Mar 2021 08:30:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B9CE860202 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 4157A8D0051; Mon, 1 Mar 2021 03:30:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C5A48D004F; Mon, 1 Mar 2021 03:30:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 302DC8D0051; Mon, 1 Mar 2021 03:30:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0045.hostedemail.com [216.40.44.45]) by kanga.kvack.org (Postfix) with ESMTP id 1A3B88D004F for ; Mon, 1 Mar 2021 03:30:25 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id CD94C4DD6 for ; Mon, 1 Mar 2021 08:30:24 +0000 (UTC) X-FDA: 77870633568.07.F539B14 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf13.hostedemail.com (Postfix) with ESMTP id 2BD82E0011E2 for ; Mon, 1 Mar 2021 08:30:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614587423; 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=MitleQLlkGN1VE4ERP6Ypb/q7crtufZjduSINbkl1RE=; b=WDPD+BfAQnP/zdkp3UtUiljjbpjbUYhFb9MppcrYzyLLABgBDAbA8Tq8yZ27B11Fd52vSM eXyuT7Xr5FU3xLbJqXyBgHYYK1kEzmMpSmOu+VYuzhmvlvdpG0fsWEJqDTufj9N1ISnvMg RZNLnEEQ7HAQ1Xtle98ej4tUVVhSuCk= 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-578-miwzFtP-OLaGJJxaqYnNjQ-1; Mon, 01 Mar 2021 03:30:21 -0500 X-MC-Unique: miwzFtP-OLaGJJxaqYnNjQ-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 07421107ACE3; Mon, 1 Mar 2021 08:30:20 +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 287205D9FC; Mon, 1 Mar 2021 08:30:17 +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: Date: Mon, 1 Mar 2021 09:30:17 +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.79 on 10.5.11.14 X-Stat-Signature: pa6p75keefkjp6g3j8q9hkn1rcsjrbdu X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 2BD82E0011E2 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf13; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=63.128.21.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614587421-485373 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: >>> + (*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 could also go with while (!IS_ALIGNED(pfn, MAX_ORDER_NR_PAGES)) { (*online_page_callback)(pfn_to_page(pfn), pageblock_order); pageblock_nr_pages; } And maybe add a comment why we can be sure it has to be aligned to pageblocks. Or maybe rather add VM_BUG_ON(IS_ALIGNED(pfn, pageblock_nr_pages)); -- Thanks, David / dhildenb