From: Gioh Kim <gioh.kim@lge.com>
To: Devendra Naga <devendranaga4@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
John Stultz <john.stultz@linaro.org>,
Rebecca Schultz Zavin <rebecca@android.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
gunho.lee@lge.com
Subject: Re: [RFC 1/2] staging: ion: shrink page-pool by page unit
Date: Fri, 24 Oct 2014 08:31:52 +0900 [thread overview]
Message-ID: <54498FE8.4010700@lge.com> (raw)
In-Reply-To: <54498C68.8090207@lge.com>
2014-10-24 오전 8:16, Gioh Kim 쓴 글:
>
>
> 2014-10-24 오전 5:36, Devendra Naga 쓴 글:
>> Hello,
>>
>> On Thu, Oct 23, 2014 at 6:22 PM, Gioh Kim <gioh.kim@lge.com> wrote:
>>> This patch shrink page-pool by page unit.
>>>
>>> Signed-off-by: Gioh Kim <gioh.kim@lge.com>
>>> ---
>>> drivers/staging/android/ion/ion_page_pool.c | 5 +++--
>>> drivers/staging/android/ion/ion_system_heap.c | 7 +++++--
>>> 2 files changed, 8 insertions(+), 4 deletions(-)
>>
>>>
>>
>> --- cut --
>>
>>> diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c
>>> index da2a63c..36e73c3 100644
>>> --- a/drivers/staging/android/ion/ion_system_heap.c
>>> +++ b/drivers/staging/android/ion/ion_system_heap.c
>>> @@ -211,7 +211,7 @@ static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask,
>>> int nr_to_scan)
>>> {
>>> struct ion_system_heap *sys_heap;
>>> - int nr_total = 0;
>>> + int nr_total = 0, nr_freed;
>>> int i;
>>>
>>> sys_heap = container_of(heap, struct ion_system_heap, heap);
>>> @@ -219,7 +219,10 @@ static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask,
>>> for (i = 0; i < num_orders; i++) {
>>> struct ion_page_pool *pool = sys_heap->pools[i];
>>>
>>> - nr_total += ion_page_pool_shrink(pool, gfp_mask, nr_to_scan);
>>> + nr_freed += ion_page_pool_shrink(pool, gfp_mask, nr_to_scan);
>>
>> nr_freed is not initialised to zero. This might result in updating of
>> a garbage value stored initially after nr_freed is created.
>
> Yes, your're right. It's my mistake.
> I testes this on my platform with custom kernel and copied codes.
> I missed a line for it.
> I'm sorry.
Following is the correct code:
nr_freed = ion_page_pool_shrink(pool, gfp_mask, nr_to_scan);
>
>>
>>> + nr_total += nr_freed;
>>> + /* nr_to_scan can be negative */
>>> + nr_to_scan -= nr_freed;
>>> }
>>>
>>> return nr_total;
>>> --
>>> 1.7.9.5
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>> Please read the FAQ at http://www.tux.org/lkml/
>>
next prev parent reply other threads:[~2014-10-23 23:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-23 12:52 [RFC 0/2] enable pool shrinking in page unit Gioh Kim
2014-10-23 12:52 ` [RFC 1/2] staging: ion: shrink page-pool by " Gioh Kim
2014-10-23 20:36 ` Devendra Naga
2014-10-23 23:16 ` Gioh Kim
2014-10-23 23:31 ` Gioh Kim [this message]
2014-10-23 23:49 ` Devendra Naga
2014-10-23 12:52 ` [RFC 2/2] staging: ion: debugfs to shrink pool Gioh Kim
2014-10-27 11:42 ` Dan Carpenter
2014-10-27 12:52 ` Dan Carpenter
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=54498FE8.4010700@lge.com \
--to=gioh.kim@lge.com \
--cc=devel@driverdev.osuosl.org \
--cc=devendranaga4@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=gunho.lee@lge.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rebecca@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