public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Laura Abbott <labbott@redhat.com>
To: Gioh Kim <gioh.kim@lge.com>,
	gregkh@linuxfoundation.org, arve@android.com,
	riandrews@android.com, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCHv3 2/2] staging: ion: debugfs to shrink pool
Date: Thu, 2 Jul 2015 11:24:16 -0700	[thread overview]
Message-ID: <559581D0.9070308@redhat.com> (raw)
In-Reply-To: <1435748578-6400-3-git-send-email-gioh.kim@lge.com>

On 07/01/2015 04:02 AM, Gioh Kim wrote:
> This patch enables debugfs file /sys/kernel/debug/ion/heaps/system_shrink

Nit: This technically enables debugfs shrinking for all heaps, not just
the system heap although the system heap is the only one with a shrinker
right now.

> to shrink pool and get pool size. It is already implemented
> but not complete. This patch completes and enables it.
>
> Reading the file returns pool size
> in page unit and writing the number of pages shrinks pool.
> It flushes all pages to write zero at the file.
>
> Signed-off-by: Gioh Kim <gioh.kim@lge.com>

Reviewed-by: Laura Abbott <labbott@redhat.com>

> ---
>   drivers/staging/android/ion/ion.c |   22 +++++++++-------------
>   1 file changed, 9 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index 6f48112..9327e8a 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -1466,7 +1466,6 @@ static const struct file_operations debug_heap_fops = {
>   	.release = single_release,
>   };
>
> -#ifdef DEBUG_HEAP_SHRINKER
>   static int debug_shrink_set(void *data, u64 val)
>   {
>   	struct ion_heap *heap = data;
> @@ -1474,15 +1473,14 @@ static int debug_shrink_set(void *data, u64 val)
>   	int objs;
>
>   	sc.gfp_mask = -1;
> -	sc.nr_to_scan = 0;
> -
> -	if (!val)
> -		return 0;
> +	sc.nr_to_scan = val;
>
> -	objs = heap->shrinker.shrink(&heap->shrinker, &sc);
> -	sc.nr_to_scan = objs;
> +	if (!val) {
> +		objs = heap->shrinker.count_objects(&heap->shrinker, &sc);
> +		sc.nr_to_scan = objs;
> +	}
>
> -	heap->shrinker.shrink(&heap->shrinker, &sc);
> +	heap->shrinker.scan_objects(&heap->shrinker, &sc);
>   	return 0;
>   }
>
> @@ -1495,14 +1493,13 @@ static int debug_shrink_get(void *data, u64 *val)
>   	sc.gfp_mask = -1;
>   	sc.nr_to_scan = 0;
>
> -	objs = heap->shrinker.shrink(&heap->shrinker, &sc);
> +	objs = heap->shrinker.count_objects(&heap->shrinker, &sc);
>   	*val = objs;
>   	return 0;
>   }
>
>   DEFINE_SIMPLE_ATTRIBUTE(debug_shrink_fops, debug_shrink_get,
>   			debug_shrink_set, "%llu\n");
> -#endif
>
>   void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap)
>   {
> @@ -1540,8 +1537,7 @@ void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap)
>   			path, heap->name);
>   	}
>
> -#ifdef DEBUG_HEAP_SHRINKER
> -	if (heap->shrinker.shrink) {
> +	if (heap->shrinker.count_objects && heap->shrinker.scan_objects) {
>   		char debug_name[64];
>
>   		snprintf(debug_name, 64, "%s_shrink", heap->name);
> @@ -1556,7 +1552,7 @@ void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap)
>   				path, debug_name);
>   		}
>   	}
> -#endif
> +
>   	up_write(&dev->lock);
>   }
>
>


      reply	other threads:[~2015-07-02 18:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-01 11:02 [PATCHv3 0/2] staging: ion: enable shrinking of pool Gioh Kim
2015-07-01 11:02 ` [PATCHv3 1/2] staging: ion: shrink page-pool by page unit Gioh Kim
2015-07-02 18:21   ` Laura Abbott
2015-07-01 11:02 ` [PATCHv3 2/2] staging: ion: debugfs to shrink pool Gioh Kim
2015-07-02 18:24   ` Laura Abbott [this message]

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=559581D0.9070308@redhat.com \
    --to=labbott@redhat.com \
    --cc=arve@android.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gioh.kim@lge.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riandrews@android.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox