Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4715568yba; Wed, 10 Apr 2019 03:26:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcU8/h0QopeuGZlhIcmzQsS9Fb/VpaUxu8jW8sLYqv5Mvaz/7lwO57YhK/dj6b+LRdECqR X-Received: by 2002:a62:ac02:: with SMTP id v2mr43037248pfe.163.1554891998670; Wed, 10 Apr 2019 03:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554891998; cv=none; d=google.com; s=arc-20160816; b=pN8/In2crm+Xo5+Z5pXtw12+g7oY6HjriNroWMj77QTQkEK/eRSIS0fvQYCMuR7fAY ez5FUH10mKmAdwwq3FqL5C/f1qGLOWJ/PCZ316LFfqoVQ/XBkQ8r7N21HfvZCHUzv5BW kxzl4MpzMXTboMhiYp8rWMxNQIyTLnHLrqSoeFnpCUHb8d7iXPgxC6tMxnQUznlw1aMB xheqJwl1TFhfjavcBMJIsP09TQp2B7w15Ch4gKjCXPropPVKD84kkxRy2/2dhDEgrGCN t1Ira9U/3PEOI0eFALFFvsxjTnKU48xN7j0sHwK9qK/EntpOtuNeLxjyA3bdEZO+ZMn8 b1sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=NlFuMUS94v2NpXZV1dscR6EYhD7U+tt6O7E/YGeBZFI=; b=x0lxjcqv31otoIw6WuYx0S/X3lpAnq8vOwKtTwew+Ezhtu792jtZXC2MpvDxmfza2+ 1bmaEUNJaUIh+Q9wt+TuKYqyV5BT3nRizbKtx3pvGphxmRKu87FGsWvz++ZyaFQqH4Yg xY0x91hrQNjxo1grEWFiIZLnUlre2GEcmFeVVfQHkZbuFhBTPDX/sNFTL/SMd7/5zCnT FKwetqHBeQQjE6DR2CNMlui60PyL0mSn8pCklQubijxsp1oAbBCCYpKpP/ZQyH1swi6y D7d4ynoBzoDLbFCrkrgQslhAd3hNfpInjb0tZwENi/bv0LbxM8M5WoCBJCa5uSC+EXHv VtQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7si30059280pgp.161.2019.04.10.03.26.23; Wed, 10 Apr 2019 03:26:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730003AbfDJKO7 (ORCPT + 99 others); Wed, 10 Apr 2019 06:14:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34812 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729876AbfDJKO6 (ORCPT ); Wed, 10 Apr 2019 06:14:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A3C4EC01089C; Wed, 10 Apr 2019 10:14:58 +0000 (UTC) Received: from t460s.redhat.com (unknown [10.36.118.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55B5917F4C; Wed, 10 Apr 2019 10:14:56 +0000 (UTC) From: David Hildenbrand To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, David Hildenbrand , Andrew Morton , Oscar Salvador , Michal Hocko , Pavel Tatashin , Wei Yang , Qian Cai , Arun KS , Mathieu Malaterre Subject: [PATCH] mm/memory_hotplug: Drop memory device reference after find_memory_block() Date: Wed, 10 Apr 2019 12:14:55 +0200 Message-Id: <20190410101455.17338-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 10 Apr 2019 10:14:58 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While current node handling is probably terribly broken for memory block devices that span several nodes (only possible when added during boot, and something like that should be blocked completely), properly put the device reference we obtained via find_memory_block() to get the nid. Fixes: d0dc12e86b31 ("mm/memory_hotplug: optimize memory hotplug") Cc: Andrew Morton Cc: Oscar Salvador Cc: Michal Hocko Cc: David Hildenbrand Cc: Pavel Tatashin Cc: Wei Yang Cc: Qian Cai Cc: Arun KS Cc: Mathieu Malaterre Signed-off-by: David Hildenbrand --- mm/memory_hotplug.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 5eb4a4c7c21b..328878b6799d 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -854,6 +854,7 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ */ mem = find_memory_block(__pfn_to_section(pfn)); nid = mem->nid; + put_device(&mem->dev); /* associate pfn range with the zone */ zone = move_pfn_range(online_type, nid, pfn, nr_pages); -- 2.20.1