diff options
author | Christoph Hellwig <hch@lst.de> | 2018-10-01 10:40:53 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-10-09 01:43:25 -0400 |
commit | 79ac32a427f5d1211fa417021fd04c36f63ab917 (patch) | |
tree | c203a3573214892eadaad406498bdb0a8a66db35 /kernel | |
parent | 99c65fa7c59ff558e70db8aa61bbdece5d3a9588 (diff) |
dma-direct: document the zone selection logic
What we are doing here isn't quite obvious, so add a comment explaining
it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/dma/direct.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 674a8da22844..a5a943836c8e 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c | |||
@@ -84,7 +84,14 @@ static gfp_t __dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask, | |||
84 | else | 84 | else |
85 | *phys_mask = dma_to_phys(dev, dma_mask); | 85 | *phys_mask = dma_to_phys(dev, dma_mask); |
86 | 86 | ||
87 | /* GFP_DMA32 and GFP_DMA are no ops without the corresponding zones: */ | 87 | /* |
88 | * Optimistically try the zone that the physical address mask falls | ||
89 | * into first. If that returns memory that isn't actually addressable | ||
90 | * we will fallback to the next lower zone and try again. | ||
91 | * | ||
92 | * Note that GFP_DMA32 and GFP_DMA are no ops without the corresponding | ||
93 | * zones. | ||
94 | */ | ||
88 | if (*phys_mask <= DMA_BIT_MASK(ARCH_ZONE_DMA_BITS)) | 95 | if (*phys_mask <= DMA_BIT_MASK(ARCH_ZONE_DMA_BITS)) |
89 | return GFP_DMA; | 96 | return GFP_DMA; |
90 | if (*phys_mask <= DMA_BIT_MASK(32)) | 97 | if (*phys_mask <= DMA_BIT_MASK(32)) |