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 7DED6C433DB for ; Mon, 1 Mar 2021 08:32:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5202B64E04 for ; Mon, 1 Mar 2021 08:32:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5202B64E04 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 D11AC8D0052; Mon, 1 Mar 2021 03:32:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CC2EF8D004F; Mon, 1 Mar 2021 03:32:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BFF738D0052; Mon, 1 Mar 2021 03:32:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0101.hostedemail.com [216.40.44.101]) by kanga.kvack.org (Postfix) with ESMTP id AA6128D004F for ; Mon, 1 Mar 2021 03:32:28 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 68257181AF5D3 for ; Mon, 1 Mar 2021 08:32:28 +0000 (UTC) X-FDA: 77870638776.15.60B8467 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 417222000385 for ; Mon, 1 Mar 2021 08:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614587547; 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=YqMJaNN/tOOuxvnEHa6KByfT7uK7qHf4HH2dNo0G9Sdh1x9Byf911MGZ48ai8C3/X0LufL RzMlbx2ySn/8PqRfgJ/jxtNuelpb4lFmv+ymJRQg234czmrABEHeqeKHzaeT975tmu8hhM vJvspmxXwqzeevwqL9wqSBkwFfH2Uf8= 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 X-Stat-Signature: s9msgc1zqu6i63dcxzbrszc48u5wnzid X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 417222000385 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf01; 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: 1614587547-784160 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 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