All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vmscan: Make move_active_pages_to_lru more generic
@ 2010-11-21 14:24 ` Minchan Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2010-11-21 14:24 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, LKML, Minchan Kim, Wu Fengguang, Rik van Riel,
	KOSAKI Motohiro, Johannes Weiner

Now move_active_pages_to_lru can move pages into active or inactive.
if it moves the pages into inactive, it itself can clear PG_acive.
It makes the function more generic.

Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>

---
 mm/vmscan.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index aa4f1cb..bd408b3 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1457,6 +1457,10 @@ static void move_active_pages_to_lru(struct zone *zone,
 		VM_BUG_ON(PageLRU(page));
 		SetPageLRU(page);
 
+		/* we are de-activating */
+		if (!is_active_lru(lru))
+			ClearPageActive(page);
+
 		list_move(&page->lru, &zone->lru[lru].list);
 		mem_cgroup_add_lru_list(page, lru);
 		pgmoved++;
@@ -1543,7 +1547,6 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
 			}
 		}
 
-		ClearPageActive(page);  /* we are de-activating */
 		list_add(&page->lru, &l_inactive);
 	}
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] vmscan: Make move_active_pages_to_lru more generic
@ 2010-11-21 14:24 ` Minchan Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2010-11-21 14:24 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, LKML, Minchan Kim, Wu Fengguang, Rik van Riel,
	KOSAKI Motohiro, Johannes Weiner

Now move_active_pages_to_lru can move pages into active or inactive.
if it moves the pages into inactive, it itself can clear PG_acive.
It makes the function more generic.

Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>

---
 mm/vmscan.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index aa4f1cb..bd408b3 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1457,6 +1457,10 @@ static void move_active_pages_to_lru(struct zone *zone,
 		VM_BUG_ON(PageLRU(page));
 		SetPageLRU(page);
 
+		/* we are de-activating */
+		if (!is_active_lru(lru))
+			ClearPageActive(page);
+
 		list_move(&page->lru, &zone->lru[lru].list);
 		mem_cgroup_add_lru_list(page, lru);
 		pgmoved++;
@@ -1543,7 +1547,6 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
 			}
 		}
 
-		ClearPageActive(page);  /* we are de-activating */
 		list_add(&page->lru, &l_inactive);
 	}
 
-- 
1.7.0.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] vmscan: Make move_active_pages_to_lru more generic
  2010-11-21 14:24 ` Minchan Kim
@ 2010-11-21 18:07   ` Rik van Riel
  -1 siblings, 0 replies; 12+ messages in thread
From: Rik van Riel @ 2010-11-21 18:07 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Andrew Morton, linux-mm, LKML, Wu Fengguang, KOSAKI Motohiro,
	Johannes Weiner

On 11/21/2010 09:24 AM, Minchan Kim wrote:
> Now move_active_pages_to_lru can move pages into active or inactive.
> if it moves the pages into inactive, it itself can clear PG_acive.
> It makes the function more generic.

> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index aa4f1cb..bd408b3 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1457,6 +1457,10 @@ static void move_active_pages_to_lru(struct zone *zone,
>   		VM_BUG_ON(PageLRU(page));
>   		SetPageLRU(page);
>
> +		/* we are de-activating */
> +		if (!is_active_lru(lru))
> +			ClearPageActive(page);
> +

Does that mean we also want code to ensure that pages have
the PG_active bit set when we add them to an active list?

-- 
All rights reversed

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] vmscan: Make move_active_pages_to_lru more generic
@ 2010-11-21 18:07   ` Rik van Riel
  0 siblings, 0 replies; 12+ messages in thread
From: Rik van Riel @ 2010-11-21 18:07 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Andrew Morton, linux-mm, LKML, Wu Fengguang, KOSAKI Motohiro,
	Johannes Weiner

On 11/21/2010 09:24 AM, Minchan Kim wrote:
> Now move_active_pages_to_lru can move pages into active or inactive.
> if it moves the pages into inactive, it itself can clear PG_acive.
> It makes the function more generic.

> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index aa4f1cb..bd408b3 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1457,6 +1457,10 @@ static void move_active_pages_to_lru(struct zone *zone,
>   		VM_BUG_ON(PageLRU(page));
>   		SetPageLRU(page);
>
> +		/* we are de-activating */
> +		if (!is_active_lru(lru))
> +			ClearPageActive(page);
> +

Does that mean we also want code to ensure that pages have
the PG_active bit set when we add them to an active list?

-- 
All rights reversed

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] vmscan: Make move_active_pages_to_lru more generic
  2010-11-21 18:07   ` Rik van Riel
@ 2010-11-22  0:49     ` Minchan Kim
  -1 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2010-11-22  0:49 UTC (permalink / raw)
  To: Rik van Riel
  Cc: Andrew Morton, linux-mm, LKML, Wu Fengguang, KOSAKI Motohiro,
	Johannes Weiner

On Mon, Nov 22, 2010 at 3:07 AM, Rik van Riel <riel@redhat.com> wrote:
> On 11/21/2010 09:24 AM, Minchan Kim wrote:
>>
>> Now move_active_pages_to_lru can move pages into active or inactive.
>> if it moves the pages into inactive, it itself can clear PG_acive.
>> It makes the function more generic.
>
>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> index aa4f1cb..bd408b3 100644
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -1457,6 +1457,10 @@ static void move_active_pages_to_lru(struct zone
>> *zone,
>>                VM_BUG_ON(PageLRU(page));
>>                SetPageLRU(page);
>>
>> +               /* we are de-activating */
>> +               if (!is_active_lru(lru))
>> +                       ClearPageActive(page);
>> +
>
> Does that mean we also want code to ensure that pages have
> the PG_active bit set when we add them to an active list?

Yes. the function name is move_"active"_pages_to_lru.
So  caller have to make sure pages have PG_active.

>
> --
> All rights reversed
>



-- 
Kind regards,
Minchan Kim

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] vmscan: Make move_active_pages_to_lru more generic
@ 2010-11-22  0:49     ` Minchan Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2010-11-22  0:49 UTC (permalink / raw)
  To: Rik van Riel
  Cc: Andrew Morton, linux-mm, LKML, Wu Fengguang, KOSAKI Motohiro,
	Johannes Weiner

On Mon, Nov 22, 2010 at 3:07 AM, Rik van Riel <riel@redhat.com> wrote:
> On 11/21/2010 09:24 AM, Minchan Kim wrote:
>>
>> Now move_active_pages_to_lru can move pages into active or inactive.
>> if it moves the pages into inactive, it itself can clear PG_acive.
>> It makes the function more generic.
>
>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> index aa4f1cb..bd408b3 100644
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -1457,6 +1457,10 @@ static void move_active_pages_to_lru(struct zone
>> *zone,
>>                VM_BUG_ON(PageLRU(page));
>>                SetPageLRU(page);
>>
>> +               /* we are de-activating */
>> +               if (!is_active_lru(lru))
>> +                       ClearPageActive(page);
>> +
>
> Does that mean we also want code to ensure that pages have
> the PG_active bit set when we add them to an active list?

Yes. the function name is move_"active"_pages_to_lru.
So  caller have to make sure pages have PG_active.

>
> --
> All rights reversed
>



-- 
Kind regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] vmscan: Make move_active_pages_to_lru more generic
  2010-11-22  0:49     ` Minchan Kim
@ 2010-11-22  1:26       ` Rik van Riel
  -1 siblings, 0 replies; 12+ messages in thread
From: Rik van Riel @ 2010-11-22  1:26 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Andrew Morton, linux-mm, LKML, Wu Fengguang, KOSAKI Motohiro,
	Johannes Weiner

On 11/21/2010 07:49 PM, Minchan Kim wrote:
> On Mon, Nov 22, 2010 at 3:07 AM, Rik van Riel<riel@redhat.com>  wrote:
>> On 11/21/2010 09:24 AM, Minchan Kim wrote:
>>>
>>> Now move_active_pages_to_lru can move pages into active or inactive.
>>> if it moves the pages into inactive, it itself can clear PG_acive.
>>> It makes the function more generic.
>>
>>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>>> index aa4f1cb..bd408b3 100644
>>> --- a/mm/vmscan.c
>>> +++ b/mm/vmscan.c
>>> @@ -1457,6 +1457,10 @@ static void move_active_pages_to_lru(struct zone
>>> *zone,
>>>                 VM_BUG_ON(PageLRU(page));
>>>                 SetPageLRU(page);
>>>
>>> +               /* we are de-activating */
>>> +               if (!is_active_lru(lru))
>>> +                       ClearPageActive(page);
>>> +
>>
>> Does that mean we also want code to ensure that pages have
>> the PG_active bit set when we add them to an active list?
>
> Yes. the function name is move_"active"_pages_to_lru.
> So  caller have to make sure pages have PG_active.

Good point.

Acked-by: Rik van Riel <riel@redhat.com>

-- 
All rights reversed

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] vmscan: Make move_active_pages_to_lru more generic
@ 2010-11-22  1:26       ` Rik van Riel
  0 siblings, 0 replies; 12+ messages in thread
From: Rik van Riel @ 2010-11-22  1:26 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Andrew Morton, linux-mm, LKML, Wu Fengguang, KOSAKI Motohiro,
	Johannes Weiner

On 11/21/2010 07:49 PM, Minchan Kim wrote:
> On Mon, Nov 22, 2010 at 3:07 AM, Rik van Riel<riel@redhat.com>  wrote:
>> On 11/21/2010 09:24 AM, Minchan Kim wrote:
>>>
>>> Now move_active_pages_to_lru can move pages into active or inactive.
>>> if it moves the pages into inactive, it itself can clear PG_acive.
>>> It makes the function more generic.
>>
>>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>>> index aa4f1cb..bd408b3 100644
>>> --- a/mm/vmscan.c
>>> +++ b/mm/vmscan.c
>>> @@ -1457,6 +1457,10 @@ static void move_active_pages_to_lru(struct zone
>>> *zone,
>>>                 VM_BUG_ON(PageLRU(page));
>>>                 SetPageLRU(page);
>>>
>>> +               /* we are de-activating */
>>> +               if (!is_active_lru(lru))
>>> +                       ClearPageActive(page);
>>> +
>>
>> Does that mean we also want code to ensure that pages have
>> the PG_active bit set when we add them to an active list?
>
> Yes. the function name is move_"active"_pages_to_lru.
> So  caller have to make sure pages have PG_active.

Good point.

Acked-by: Rik van Riel <riel@redhat.com>

-- 
All rights reversed

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] vmscan: Make move_active_pages_to_lru more generic
  2010-11-21 14:24 ` Minchan Kim
@ 2010-11-22  1:36   ` Wu Fengguang
  -1 siblings, 0 replies; 12+ messages in thread
From: Wu Fengguang @ 2010-11-22  1:36 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Andrew Morton, linux-mm, LKML, Rik van Riel, KOSAKI Motohiro,
	Johannes Weiner

On Sun, Nov 21, 2010 at 10:24:56PM +0800, Minchan Kim wrote:
> Now move_active_pages_to_lru can move pages into active or inactive.
> if it moves the pages into inactive, it itself can clear PG_acive.
> It makes the function more generic.

Do you plan to use this "more generic" function? Because the patch in
itself makes code slightly less efficient. It adds one "if" test, and
moves one operation into the spin lock.

Thanks,
Fengguang

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] vmscan: Make move_active_pages_to_lru more generic
@ 2010-11-22  1:36   ` Wu Fengguang
  0 siblings, 0 replies; 12+ messages in thread
From: Wu Fengguang @ 2010-11-22  1:36 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Andrew Morton, linux-mm, LKML, Rik van Riel, KOSAKI Motohiro,
	Johannes Weiner

On Sun, Nov 21, 2010 at 10:24:56PM +0800, Minchan Kim wrote:
> Now move_active_pages_to_lru can move pages into active or inactive.
> if it moves the pages into inactive, it itself can clear PG_acive.
> It makes the function more generic.

Do you plan to use this "more generic" function? Because the patch in
itself makes code slightly less efficient. It adds one "if" test, and
moves one operation into the spin lock.

Thanks,
Fengguang

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] vmscan: Make move_active_pages_to_lru more generic
  2010-11-22  1:36   ` Wu Fengguang
@ 2010-11-22  1:50     ` Minchan Kim
  -1 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2010-11-22  1:50 UTC (permalink / raw)
  To: Wu Fengguang
  Cc: Andrew Morton, linux-mm, LKML, Rik van Riel, KOSAKI Motohiro,
	Johannes Weiner

Hi Wu,

On Mon, Nov 22, 2010 at 10:36 AM, Wu Fengguang <fengguang.wu@intel.com> wrote:
> On Sun, Nov 21, 2010 at 10:24:56PM +0800, Minchan Kim wrote:
>> Now move_active_pages_to_lru can move pages into active or inactive.
>> if it moves the pages into inactive, it itself can clear PG_acive.
>> It makes the function more generic.
>
> Do you plan to use this "more generic" function? Because the patch in
> itself makes code slightly less efficient. It adds one "if" test, and
> moves one operation into the spin lock.

I tried to use it in my deactivate page series but couldn't use it due
some problem.
So I don't have a plan to use it. It's just my preference(and I hope
others think like me :) )

I hope function itself would be generic and clear because some people
in future might use it and reference it.
If my change makes big cost, I am not against you. otherwise, I hope
move_active_pages_to_lru become self-contained.

>
> Thanks,
> Fengguang
>



-- 
Kind regards,
Minchan Kim

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] vmscan: Make move_active_pages_to_lru more generic
@ 2010-11-22  1:50     ` Minchan Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2010-11-22  1:50 UTC (permalink / raw)
  To: Wu Fengguang
  Cc: Andrew Morton, linux-mm, LKML, Rik van Riel, KOSAKI Motohiro,
	Johannes Weiner

Hi Wu,

On Mon, Nov 22, 2010 at 10:36 AM, Wu Fengguang <fengguang.wu@intel.com> wrote:
> On Sun, Nov 21, 2010 at 10:24:56PM +0800, Minchan Kim wrote:
>> Now move_active_pages_to_lru can move pages into active or inactive.
>> if it moves the pages into inactive, it itself can clear PG_acive.
>> It makes the function more generic.
>
> Do you plan to use this "more generic" function? Because the patch in
> itself makes code slightly less efficient. It adds one "if" test, and
> moves one operation into the spin lock.

I tried to use it in my deactivate page series but couldn't use it due
some problem.
So I don't have a plan to use it. It's just my preference(and I hope
others think like me :) )

I hope function itself would be generic and clear because some people
in future might use it and reference it.
If my change makes big cost, I am not against you. otherwise, I hope
move_active_pages_to_lru become self-contained.

>
> Thanks,
> Fengguang
>



-- 
Kind regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-11-22  1:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-21 14:24 [PATCH] vmscan: Make move_active_pages_to_lru more generic Minchan Kim
2010-11-21 14:24 ` Minchan Kim
2010-11-21 18:07 ` Rik van Riel
2010-11-21 18:07   ` Rik van Riel
2010-11-22  0:49   ` Minchan Kim
2010-11-22  0:49     ` Minchan Kim
2010-11-22  1:26     ` Rik van Riel
2010-11-22  1:26       ` Rik van Riel
2010-11-22  1:36 ` Wu Fengguang
2010-11-22  1:36   ` Wu Fengguang
2010-11-22  1:50   ` Minchan Kim
2010-11-22  1:50     ` Minchan Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.