All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: linux-kernel <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Benjamin Serebrin
	<serebrin-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Eric Dumazet <edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Subject: [PATCH v2] iommu/vt-d: add NUMA awareness to intel_alloc_coherent()
Date: Wed, 31 Jan 2018 22:33:59 -0800	[thread overview]
Message-ID: <1517466839.3715.115.camel@gmail.com> (raw)
In-Reply-To: <1517438756.3715.108.camel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

From: Eric Dumazet <edumazet@google.com>

Some devices (like mlx4) try hard to allocate memory on selected
NUMA node, but it turns out intel_alloc_coherent() is not NUMA
aware yet.

Note that dma_generic_alloc_coherent() in arch/x86/kernel/pci-dma.c
gets this right.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Benjamin Serebrin <serebrin@google.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Joerg Roedel <joro@8bytes.org>
---
v2: no fallback to alloc_pages(), this is not needed and might even
hurt in OOM cases.

 drivers/iommu/intel-iommu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index a1373cf343269455808f66ad18dc0a2fb7aa73f2..3c538466a98bdb8fffdca688462b1350d536791b 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -3735,7 +3735,7 @@ static void *intel_alloc_coherent(struct device *dev, size_t size,
 	}
 
 	if (!page)
-		page = alloc_pages(flags, order);
+		page = alloc_pages_node(dev_to_node(dev), flags, order);
 	if (!page)
 		return NULL;
 	memset(page_address(page), 0, size);

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: Eric Dumazet <eric.dumazet@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Benjamin Serebrin <serebrin@google.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Joerg Roedel <joro@8bytes.org>,
	iommu@lists.linux-foundation.org, netdev <netdev@vger.kernel.org>,
	Eric Dumazet <edumazet@google.com>
Subject: [PATCH v2] iommu/vt-d: add NUMA awareness to intel_alloc_coherent()
Date: Wed, 31 Jan 2018 22:33:59 -0800	[thread overview]
Message-ID: <1517466839.3715.115.camel@gmail.com> (raw)
In-Reply-To: <1517438756.3715.108.camel@gmail.com>

From: Eric Dumazet <edumazet@google.com>

Some devices (like mlx4) try hard to allocate memory on selected
NUMA node, but it turns out intel_alloc_coherent() is not NUMA
aware yet.

Note that dma_generic_alloc_coherent() in arch/x86/kernel/pci-dma.c
gets this right.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Benjamin Serebrin <serebrin@google.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Joerg Roedel <joro@8bytes.org>
---
v2: no fallback to alloc_pages(), this is not needed and might even
hurt in OOM cases.

 drivers/iommu/intel-iommu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index a1373cf343269455808f66ad18dc0a2fb7aa73f2..3c538466a98bdb8fffdca688462b1350d536791b 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -3735,7 +3735,7 @@ static void *intel_alloc_coherent(struct device *dev, size_t size,
 	}
 
 	if (!page)
-		page = alloc_pages(flags, order);
+		page = alloc_pages_node(dev_to_node(dev), flags, order);
 	if (!page)
 		return NULL;
 	memset(page_address(page), 0, size);

  parent reply	other threads:[~2018-02-01  6:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31 22:45 [PATCH] iommu/vt-d: add NUMA awareness to intel_alloc_coherent() Eric Dumazet
2018-02-01  1:46 ` Eric Dumazet
     [not found] ` <1517438756.3715.108.camel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-01  6:33   ` Eric Dumazet [this message]
2018-02-01  6:33     ` [PATCH v2] " Eric Dumazet
2018-02-02 18:53   ` [PATCH] " Christoph Hellwig
2018-02-02 18:53     ` Christoph Hellwig
2018-02-02 18:59     ` Eric Dumazet
2020-04-01 22:53       ` Eric Dumazet
2020-04-01 22:53         ` Eric Dumazet
2020-04-02  6:56         ` Christoph Hellwig
2020-04-02  6:56           ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1517466839.3715.115.camel@gmail.com \
    --to=eric.dumazet-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=serebrin-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.