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=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 1C1BCC433DB for ; Fri, 26 Mar 2021 13:36:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8BF5161879 for ; Fri, 26 Mar 2021 13:36:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BF5161879 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 A24376B006C; Fri, 26 Mar 2021 09:36:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9FAC26B006E; Fri, 26 Mar 2021 09:36:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C36B6B0070; Fri, 26 Mar 2021 09:36:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0138.hostedemail.com [216.40.44.138]) by kanga.kvack.org (Postfix) with ESMTP id 6FB456B006C for ; Fri, 26 Mar 2021 09:36:40 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1E19B18140B67 for ; Fri, 26 Mar 2021 13:36:40 +0000 (UTC) X-FDA: 77962125360.28.4DDDBCD Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf15.hostedemail.com (Postfix) with ESMTP id B2A75A000385 for ; Fri, 26 Mar 2021 13:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616765796; 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=h3gpFQKgjHtuiCQHwXaw41b8dNjFrCUF0CIAt2id5HA=; b=L1Vc8n6r289QDw2icmLAge3iN52iRCkUJ5sjY9zm/LNWgu9H8PnlR+oygndShJPur3Jo9R 5uIde07v63hy6/V7E/ND4l+WXFFw8Q4/jPnl0xmE5qRNYElly9tFcgoVsApM7LMO3ExUXW apqycga87AEDai5iyJOJxtXlr5PjRY0= 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-503-CdlsreH5O3S6QpBD8krjHg-1; Fri, 26 Mar 2021 09:36:32 -0400 X-MC-Unique: CdlsreH5O3S6QpBD8krjHg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9D88F180FCA4; Fri, 26 Mar 2021 13:36:30 +0000 (UTC) Received: from [10.36.112.81] (ovpn-112-81.ams2.redhat.com [10.36.112.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40B286BC2D; Fri, 26 Mar 2021 13:36:28 +0000 (UTC) To: Oscar Salvador Cc: Michal Hocko , Andrew Morton , Anshuman Khandual , Vlastimil Babka , Pavel Tatashin , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <40fac999-2d28-9205-23f0-516fa9342bbe@redhat.com> <92fe19d0-56ac-e929-a9c1-d6a4e0da39d1@redhat.com> <5be95091-b4ac-8e05-4694-ac5c65f790a4@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Subject: Re: [PATCH v5 1/5] mm,memory_hotplug: Allocate memmap from the added memory range Message-ID: Date: Fri, 26 Mar 2021 14:36:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Stat-Signature: rwx5jh4cbr8d9zo4aqji9377opwbgi1u X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B2A75A000385 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616765795-884610 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: >>> >>> Further a locking rework might be necessary. We hold the device hotpl= ug >>> lock, but not the memory hotplug lock. E.g., for get_online_mems(). M= ight >>> have to move that out online_pages. >=20 > That is a good point. > I yet have to think about it further, but what about moving those > mem_hotplug_{begin,done} to memory_block_{offline,online}. >=20 > Something like: >=20 > static int memory_block_online(...) > { > int ret; > =20 > mem_hotplug_begin(); > =20 > if (nr_vmemmap_pages) > vmemmap_hotplug_init(); > =20 > ret =3D online_pages(...); > if (ret) > /* > * Cleanup stuff > */ > =20 > mem_hotplug_done(); > } > =09 > As you said, you finished cleaning up those users who were calling > {online,offline}_pages() directly, but is this something that we will > forbidden in the future too? Well, I cannot tell what will happen in the future. But at least as long=20 as we have memory blocks, I doubt that there are valid use cases for=20 online_pages()/offline_pages(). Especially once we have things like=20 memmap_on_memory that need special care. > My question falls within "Are we sure we will not need that locking bac= k > in those functions because that is something we will not allow to > happen?" Who has access to online_pages()/offline_pages() also has access to=20 mem_hotplug_begin()/mem_hotplug_done(). It would be nice if we could=20 only use online_pages()/offline_pages() internally -- or at least add a=20 comment that this is for internal purposes only / requires that locking. --=20 Thanks, David / dhildenb