Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp244672pxy; Wed, 21 Apr 2021 01:49:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDK71hZYrCoaIC/u2zu+yRQmtqgf3/9rp65JVJmKYt2ibo41ZIviQk2TrbiY95JHvdDQ/m X-Received: by 2002:a17:906:a006:: with SMTP id p6mr32390429ejy.350.1618994949810; Wed, 21 Apr 2021 01:49:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618994949; cv=none; d=google.com; s=arc-20160816; b=j43h8Lkn8sWj3n+qsMx/QwySoJ2muIdTFFnLRInhjioqdhkTBXyYf47sCuS8yWyjkC efGflC8MZ6efq9C+qb9hOMBD5hUDnps4N30S6+FXHpFAM4bV7ZkVyyu2dGCw9wvD6aIf 9wYkTkvh/K9r/wokx5qxrJ5C4Mo346vjYo7mqdFKEkOcVwHuGxEc3qLAyf0UNjJZSaDQ b4JegnDyL3PVsPZro1hL42yix0iJ/XEp1zULaOzrlfRQamnAMnZlKUK84MXFJeLaBMKZ S7It+vx1e7At6xKH8u7CHKmeNxbA81HjcUFz+sO1cEX4kTu4VQHuWLN3SNniRDsY/33t tWsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=oK3rihUx7OjIP8MnUHMJzvDGc/eOqRPG2UhKmsMq4M0=; b=NJ6THmKega8dtOKNKdB55dFLJglk5XFYoIjj74qdnDe0hIigO0NAQYkeYjaAh0SC2l Uhq0XIRXC2XIL48uBk4FSgKTFishJVil8HTdMdk3CyDtCtgoG4dDJ9HB15eiDVexib14 lu6uv/Dr8+tK35SK4f6AypuW0cSwICgxJ5NrM4ZHfEkEeTMhLmkivfEhIM57vaytB7AK GRck93WsO8phNvxIknaFCfkp2QjvRtmGlQ0HPhD9CY8aVKbWHwhUlqxv1IuopBqahUvP ngWJc00z/Cu0IDyDt65E1c9V7n1GLSdTIk7vPTQxYoYCHsASDNtvodCxnl/vqMj4ATZW XsdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UZW5Khe6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si1468981edo.197.2021.04.21.01.48.46; Wed, 21 Apr 2021 01:49:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UZW5Khe6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234306AbhDUIHL (ORCPT + 99 others); Wed, 21 Apr 2021 04:07:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23330 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230516AbhDUIHK (ORCPT ); Wed, 21 Apr 2021 04:07:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618992397; 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=oK3rihUx7OjIP8MnUHMJzvDGc/eOqRPG2UhKmsMq4M0=; b=UZW5Khe6lh5gHHWlcAUDR38ItYn3AvecgEQoiZ4scT//QAD74YgSv7MrqSUL+9pKVcK6/C UH+kcBVDPLhM4ArAmtLjGW+a7D90FgJbo4foxS11T8Lm+qFmVyY6x/EkbDaOMdDq5To6tx fyI2pD7tGt6epiqN+4H3X6NZjz4pNz4= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-460-A8yo4FyyP7CYbUocy3WK1w-1; Wed, 21 Apr 2021 04:06:36 -0400 X-MC-Unique: A8yo4FyyP7CYbUocy3WK1w-1 Received: by mail-wm1-f72.google.com with SMTP id k26-20020a7bc41a0000b0290125f388fcfbso118071wmi.9 for ; Wed, 21 Apr 2021 01:06:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=oK3rihUx7OjIP8MnUHMJzvDGc/eOqRPG2UhKmsMq4M0=; b=nzeKLWAgLhE1WnUGCw8MC7mk3V/GyDnFRp5BUB5dXdnlkj0MvKhwCPBw08+W7srX1C J+ZLi2sXeQmSfB8qfU7ua1ADgB71lEflaZEtJJQlEVoruebMYy+08aNWOHPF40CdGrzq pSEyBC0TFvoaLlNOmH3xqmhDX92jZSXF2Vq0uvAHQEOKzqqs6Ah8nPSOkVKLU0NITPFV y0RgrK/gwZXfkfnU3F5NZxBd7voWrieQj1BdVWXq3IOU0ArwCvza+t4n7KNLrhhQs5el Px+k/Iadmft0oQBIOko0lbie9lQuN7itZ9R6DRcCuA1CSJvPqxAXuiaWdAwgxPbiRVKA 4YsQ== X-Gm-Message-State: AOAM530+OH/W6KG34o4BLtA+wh2Uv6CwmSwgMedyPcxiBhSuHUxfzfJq z7MXiMtxxLqTp9Ujr2wITA4pX6DpelDIR4efJddQE4T9/oDqiWzlbYojFrsvD0UKOclgK9IZD3T CP8iGABunwB+P5n2CmPbhBy/26B3uhknrELZnzCT/ZE2Qj8bQPbv+5uJ7u6SXyXhgWi/MQhUl X-Received: by 2002:a5d:424a:: with SMTP id s10mr26464906wrr.70.1618992394862; Wed, 21 Apr 2021 01:06:34 -0700 (PDT) X-Received: by 2002:a5d:424a:: with SMTP id s10mr26464883wrr.70.1618992394632; Wed, 21 Apr 2021 01:06:34 -0700 (PDT) Received: from [192.168.3.132] (p5b0c64b8.dip0.t-ipconnect.de. [91.12.100.184]) by smtp.gmail.com with ESMTPSA id h81sm1747260wmf.41.2021.04.21.01.06.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Apr 2021 01:06:34 -0700 (PDT) Subject: Re: [PATCH v9 3/8] mm,memory_hotplug: Factor out adjusting present pages into adjust_present_page_count() To: Oscar Salvador , Michal Hocko Cc: Andrew Morton , Anshuman Khandual , Pavel Tatashin , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20210416112411.9826-1-osalvador@suse.de> <20210416112411.9826-4-osalvador@suse.de> <20210421080036.GC22456@linux> From: David Hildenbrand Organization: Red Hat Message-ID: Date: Wed, 21 Apr 2021 10:06:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210421080036.GC22456@linux> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21.04.21 10:00, Oscar Salvador wrote: > On Tue, Apr 20, 2021 at 11:45:55AM +0200, Michal Hocko wrote: >> On Fri 16-04-21 13:24:06, Oscar Salvador wrote: >>> From: David Hildenbrand >>> >>> Let's have a single place (inspired by adjust_managed_page_count()) where >>> we adjust present pages. >>> In contrast to adjust_managed_page_count(), only memory onlining/offlining >>> is allowed to modify the number of present pages. >>> >>> Signed-off-by: David Hildenbrand >>> Signed-off-by: Oscar Salvador >>> Reviewed-by: Oscar Salvador >> >> Not sure self review counts ;) > > Uhm, the original author is David, I just added my signed-off-by as a deliverer. > I thought that in that case was ok to stick my Reviewed-by. > Or maybe my signed-off-by carries that implicitly. > >> Acked-by: Michal Hocko >> >> Btw. I strongly suspect the resize lock is quite pointless here. >> Something for a follow up patch. > > What makes you think that? > I have been thinking about this, let us ignore this patch for a moment. > > If I poked the code correctly, node_size_lock is taken in: > > remove_pfn_range_from_zone() > move_pfn_range_to_zone() > > both of them handling {zone,node}->spanned_pages > > Then we take it in {offline,online}_pages() for {zone,node}->present_pages. > > The other places where we take it are __init functions, so not of interest. > > Given that {offline,online}_pages() is serialized by the memory_hotplug lock, > I would say that {node,zone}->{spanned,present}_pages is, at any time, stable? > So, no need for the lock even without considering this patch? > > Now, getting back to this patch. > adjust_present_page_count() will be called from memory_block_online(), which > is not holding the memory_hotplug lock yet. > But, we only fiddle with present pages out of {online,offline}_pages() if > we have vmemmap pages, and since that operates on the same memory block, > its lock should serialize that. > > I think I went down a rabbit hole, I am slightly confused now. We always hold the device hotplug lock when onlining/offlining memory. I agree that the lock might be unnecessary (had the same thoughts a while ago), we can look into that in the future. -- Thanks, David / dhildenb