From patchwork Wed Nov 11 21:16:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 7597851 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 01CC0BF90C for ; Wed, 11 Nov 2015 21:16:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 25FEB2061C for ; Wed, 11 Nov 2015 21:16:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 250D0205F5 for ; Wed, 11 Nov 2015 21:16:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752258AbbKKVQy (ORCPT ); Wed, 11 Nov 2015 16:16:54 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:37349 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751522AbbKKVQy (ORCPT ); Wed, 11 Nov 2015 16:16:54 -0500 Received: by wmww144 with SMTP id w144so61926552wmw.0 for ; Wed, 11 Nov 2015 13:16:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plexistor_com.20150623.gappssmtp.com; s=20150623; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=MwTa934TrjiU++N9TZdbIXwOX4J2O/w/sN+mre0SF6k=; b=ZjoauLJMbF7jcTRShWEL01VxQQFvrU/eH/VeB0m6bbY/SglgOkvd2MYiroZMtvfjwG +pZnZ2jRoqnYoziJ5j0vZY8SOqCjW3+0XWAEtj+xL9wTPmKBOYyjKuDMMPnuQe+eCQDK 1nuLb2v3yhGbVrkdd1+igqDhR+FCmGR7bA6jQspDnxSZqErAW8sxF8Elp58Emz9wX95m RYla3TDeynNL5ExxApB2b2sGc6q/n6SPGdzYOjgqURLUXTRM/Pkagje/q2AtyR8kTyEj V80iKWP+lyrAZA2jSM95mmTxx0cQRLfz/bHMoy/Sr1+ji/5e6EClAp7rHQJ/MIGeENE2 wbAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=MwTa934TrjiU++N9TZdbIXwOX4J2O/w/sN+mre0SF6k=; b=fwMk7Zd+aaRURuqVbKIsQM/AK5FRIW+kyYEPlUbwosNn21F2r3Kex6aoW3QyBo4zTQ CJ6uA3bRnEWEidwGCyxHGOl101X2cPdqWNj8xxdv5nKs2dKqMkDFTO8hR3M3p1fB/xV1 n+uv6WlQiQ+VGGSpkIeifOgL1tnWyIAyKUabJPo1FPwyNLAh5zHRisCS37Tg8AI8VbVh +n48inuSojTF1MzoPaseK2/oWVE2rfUoqP7BwkkJYMEqn/xpm8TpdXsWtBHHSE9aBSDw PUX9iZNWNZyCaVjLUir0h8NdeMp5Tqjex7f4yAWbWP6PMR9+NWeW1IAArSaPwpjMSFhP HBJA== X-Gm-Message-State: ALoCoQkYUqmx+/eFCEq6KLb9r37j6qdCbbjdr4Ely2o735eUFSg9ROyuLk2RwqNvmlSH6D/98eFO X-Received: by 10.28.20.139 with SMTP id 133mr43440113wmu.36.1447276612831; Wed, 11 Nov 2015 13:16:52 -0800 (PST) Received: from [10.0.0.5] ([207.232.55.62]) by smtp.googlemail.com with ESMTPSA id u205sm2085865wmb.12.2015.11.11.13.16.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Nov 2015 13:16:52 -0800 (PST) Message-ID: <5643B043.3010103@plexistor.com> Date: Wed, 11 Nov 2015 23:16:51 +0200 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Dan Williams CC: linux-fsdevel , "linux-nvdimm@lists.01.org" Subject: [RFC 1/1] memremap: devm_memremap_pages has wrong nid Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The pmem dev as received in devm_memremap_pages() does not have its dev->numa_node properly initialized yet. What I see is that all pmem devices will call arch_add_memory with nid==0 regardless of the real nid the memory is actually on. Needless to say that after that all the NUMA page and zone members (at page->flags) come out wrong. If I do the below code it will all work properly. RFC because probably we want to fix dev->numa_node before the call to devm_memremap_pages. This is on top of v4.3. I will please need the final fix for Stable@ Thanks Signed-off-by: Boaz Harrosh --- kernel/memremap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/memremap.c b/kernel/memremap.c index 9d6b555..9409e23 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c @@ -183,9 +183,7 @@ void *devm_memremap_pages(struct device *dev, struct resource *res) memcpy(&page_map->res, res, sizeof(*res)); - nid = dev_to_node(dev); - if (nid < 0) - nid = 0; + nid = memory_add_physaddr_to_nid(res->start); error = arch_add_memory(nid, res->start, resource_size(res), true); if (error) {