aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/intel-iommu.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 466079535330..4e1dd40f18e3 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -387,33 +387,14 @@ static struct kmem_cache *iommu_domain_cache;
387static struct kmem_cache *iommu_devinfo_cache; 387static struct kmem_cache *iommu_devinfo_cache;
388static struct kmem_cache *iommu_iova_cache; 388static struct kmem_cache *iommu_iova_cache;
389 389
390static inline void *iommu_kmem_cache_alloc(struct kmem_cache *cachep)
391{
392 unsigned int flags;
393 void *vaddr;
394
395 /* trying to avoid low memory issues */
396 flags = current->flags & PF_MEMALLOC;
397 current->flags |= PF_MEMALLOC;
398 vaddr = kmem_cache_alloc(cachep, GFP_ATOMIC);
399 current->flags &= (~PF_MEMALLOC | flags);
400 return vaddr;
401}
402
403
404static inline void *alloc_pgtable_page(int node) 390static inline void *alloc_pgtable_page(int node)
405{ 391{
406 unsigned int flags;
407 struct page *page; 392 struct page *page;
408 void *vaddr = NULL; 393 void *vaddr = NULL;
409 394
410 /* trying to avoid low memory issues */
411 flags = current->flags & PF_MEMALLOC;
412 current->flags |= PF_MEMALLOC;
413 page = alloc_pages_node(node, GFP_ATOMIC | __GFP_ZERO, 0); 395 page = alloc_pages_node(node, GFP_ATOMIC | __GFP_ZERO, 0);
414 if (page) 396 if (page)
415 vaddr = page_address(page); 397 vaddr = page_address(page);
416 current->flags &= (~PF_MEMALLOC | flags);
417 return vaddr; 398 return vaddr;
418} 399}
419 400
@@ -424,7 +405,7 @@ static inline void free_pgtable_page(void *vaddr)
424 405
425static inline void *alloc_domain_mem(void) 406static inline void *alloc_domain_mem(void)
426{ 407{
427 return iommu_kmem_cache_alloc(iommu_domain_cache); 408 return kmem_cache_alloc(iommu_domain_cache, GFP_ATOMIC);
428} 409}
429 410
430static void free_domain_mem(void *vaddr) 411static void free_domain_mem(void *vaddr)
@@ -434,7 +415,7 @@ static void free_domain_mem(void *vaddr)
434 415
435static inline void * alloc_devinfo_mem(void) 416static inline void * alloc_devinfo_mem(void)
436{ 417{
437 return iommu_kmem_cache_alloc(iommu_devinfo_cache); 418 return kmem_cache_alloc(iommu_devinfo_cache, GFP_ATOMIC);
438} 419}
439 420
440static inline void free_devinfo_mem(void *vaddr) 421static inline void free_devinfo_mem(void *vaddr)
@@ -444,7 +425,7 @@ static inline void free_devinfo_mem(void *vaddr)
444 425
445struct iova *alloc_iova_mem(void) 426struct iova *alloc_iova_mem(void)
446{ 427{
447 return iommu_kmem_cache_alloc(iommu_iova_cache); 428 return kmem_cache_alloc(iommu_iova_cache, GFP_ATOMIC);
448} 429}
449 430
450void free_iova_mem(struct iova *iova) 431void free_iova_mem(struct iova *iova)