Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5609994yba; Thu, 11 Apr 2019 01:42:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzj/MNU1aCsMWWOf8eGRNOGpW4K97yR2CYBzoTWWoQ8kcATMoVnzKvxqMkrLzDsD9nQ4mO3 X-Received: by 2002:a17:902:b28b:: with SMTP id u11mr48070144plr.257.1554972160977; Thu, 11 Apr 2019 01:42:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554972160; cv=none; d=google.com; s=arc-20160816; b=MOYHAluD9h5pNolbNoO+NI1aZv44APklfWYYcBIE3aJx2dHdwEMFqfXeLbrWxlBmrI 1sbcVay735ao1dVxQYK37U0d28Ksvq7/+pGEtN06duyGvWPep++uYlfRVwmvagSs5fLZ xZFPfU1Cvk7lPR85utl31sEmXfSkPGC0xwHmtF+wgKRZH5ZnFF3I0En2+UZCcxAC/H7i GKgG3vvDRdHs93FCbPmXX3hAcb4xbXgmlTcJf2QVGt4FaYQfc3IH2ylupS+NwqfUBBpI Dnk2p6T9Qy9Z6xR0WlyznRjpdP2L6iV8yJ6vjjg4YUyietolOmNOLK0W0Jt/7Qap/5lW 7PLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Hv0Tu5vKqrOSuiUXKFVHMWeUz81r+CwRL52LI/dsHVw=; b=zaV0JktjB5/y64nHxqa6r6pMwhiSfRAB8k3E/yvNXM9qbFKi7ItEyvuzpyTxTQ73U+ 1U+Wm0SYsXbBmAsem64vJWdzFcIh0mjYPisvHN3Fa4h+bdo1sw281A/tviO8hNBpFCq1 GHkMW9v5+yn2IaXL0h8Ti1kijpZ3dQtWC2FlvPHE26Ly0Hm/KZE7twh4E9hUnxa3INeL YVRIjHmv0xN5g8nirkjK3VWnRcQdgxVU0NoTCWfV92/cIw4GEyhTQELnKCTWUWb3f6LI Z3d0YzP0HE6VxqfILeiqDgy+48eGoh3VyppPPdrZBr5fx79/V+24L7QxKRyoBtPCj5zv pgyQ== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 143si25595923pga.118.2019.04.11.01.42.24; Thu, 11 Apr 2019 01:42:40 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726723AbfDKIlp (ORCPT + 99 others); Thu, 11 Apr 2019 04:41:45 -0400 Received: from mx2.suse.de ([195.135.220.15]:33768 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726106AbfDKIlp (ORCPT ); Thu, 11 Apr 2019 04:41:45 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B8AC1AD65; Thu, 11 Apr 2019 08:41:43 +0000 (UTC) Date: Thu, 11 Apr 2019 10:41:41 +0200 From: Michal Hocko To: David Hildenbrand Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Oscar Salvador , Pavel Tatashin , Wei Yang , Qian Cai , Arun KS , Mathieu Malaterre Subject: Re: [PATCH] mm/memory_hotplug: Drop memory device reference after find_memory_block() Message-ID: <20190411084141.GQ10383@dhcp22.suse.cz> References: <20190410101455.17338-1-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190410101455.17338-1-david@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 10-04-19 12:14:55, David Hildenbrand wrote: > 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. The changelog could see some improvements I believe. (Half) stating broken status of multinode memblock is not really useful without a wider context so I would simply remove it. More to the point, it would be much better to actually describe the actual problem and the user visible effect. " d0dc12e86b31 ("mm/memory_hotplug: optimize memory hotplug") has started using find_memory_block to get a nodeid for the beginnig of the onlined pfn range. The commit has missed that the memblock contains a reference counted object and a missing put_device will leak the kobject behind which ADD THE USER VISIBLE EFFECT HERE. " > 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 Other than that Acked-by: Michal Hocko > --- > 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 -- Michal Hocko SUSE Labs