Re: [PATCH 1/1] staging: ion: debugfs sparse warning, proper mask

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm sorry, it seems I am mistaken. This was in reference to patches which
weren't committed.

Please see:
http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2014-October/060203.html
for the patch with this specific mask used.

The reason __GFP_HIGHMEM may have been chosen is because in the chain of calls to ion_heap_shrink_count(), ion_system_heap_shrink(), ion_page_pool_shrink(),
the mask is only ever compared against __GFP_HIGHMEM.

From drivers/staging/android/ion/ion_page_pool.c:
  122         if (current_is_kswapd())
  123                 high = true;
  124         else
  125                 high = !!(gfp_mask & __GFP_HIGHMEM);

Kind Regards,
Derek Yerger

On 02/22/2016 02:18 PM, Laura Abbott wrote:
On 02/20/2016 07:15 PM, Derek Yerger wrote:
 From drivers/staging/android TODO file - sparse errors.

The current code attempts assignment of -1 to unsigned type gfp_t.
Assignment should be an enumerated type of GFP_KERNEL, GFP_ATOMIC,
GFP_HIGHMEM, or __GFP_HIGH.

The original 2014 patch by Gioh Kim adding debugfs support to android/ion
used __GFP_HIGHMEM as the mask, but was removed in a subsequent revert.
This patch removes the sparse errors, and fixes the assignment as noted
above.

Please add commit references for the patches you are referring to.
At least in the upstream staging tree the GFP mask has been -1 since it was initially added (ea313b5f8 "gpu: ion: Also shrink memory cached in the deferred free list") and I can't find the commits from Gioh Kim you are referring to.

Signed-off-by: Derek Yerger <dy@xxxxxxxxxx>
---
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index c97e82b..a9ca46f 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -1524,7 +1524,7 @@ static int debug_shrink_set(void *data, u64 val)
      struct shrink_control sc;
      int objs;

-    sc.gfp_mask = -1;
+    sc.gfp_mask = __GFP_HIGHMEM;
      sc.nr_to_scan = val;

Using just __GFP_HIGHMEM is a bit weird for a GFP mask. I'd rather see this be something like GFP_HIGHUSER to represent what an actual allocation might
be or add a comment explaining why just __GFP_HIGHMEM is okay.

Thanks,
Laura


      if (!val) {
@@ -1542,7 +1542,7 @@ static int debug_shrink_get(void *data, u64 *val)
      struct shrink_control sc;
      int objs;

-    sc.gfp_mask = -1;
+    sc.gfp_mask = __GFP_HIGHMEM;
      sc.nr_to_scan = 0;

      objs = heap->shrinker.count_objects(&heap->shrinker, &sc);
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux