mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Minchan Kim <minchan.kim@gmail.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Minchan Kim <minchan.kim@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	dhowells@redhat.com, torvalds@linux-foundation.org,
	peterz@infradead.org, Enrik.Berkhan@ge.com,
	uclinux-dev@uclinux.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, Johannes Weiner <hannes@cmpxchg.org>,
	Rik van Riel <riel@surriel.com>,
	Lee Schermerhorn <lee.schermerhorn@hp.com>
Subject: Re: [PATCH] NOMMU: Pages allocated to a ramfs inode's pagecache may get wrongly discarded
Date: Thu, 12 Mar 2009 10:52:26 +0900	[thread overview]
Message-ID: <20090312105226.88df3f63.minchan.kim@barrios-desktop> (raw)
In-Reply-To: <20090312100049.43A3.A69D9226@jp.fujitsu.com>

Hi, Kosaki-san. 

I think ramfs pages's unevictablility should not depend on CONFIG_UNEVICTABLE_LRU.
It would be better to remove dependency of CONFIG_UNEVICTABLE_LRU ?


How about this ? 
It's just RFC. It's not tested. 

That's because we can't reclaim that pages regardless of whether there is unevictable list or not

>From 487ce9577ea9c43b04ff340a1ba8c4030873e875 Mon Sep 17 00:00:00 2001
From: MinChan Kim <minchan.kim@gmail.com>
Date: Thu, 12 Mar 2009 10:35:37 +0900
Subject: [PATCH] test
 Signed-off-by: MinChan Kim <minchan.kim@gmail.com>

---
 include/linux/pagemap.h |    9 ---------
 include/linux/swap.h    |    9 ++-------
 2 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 4d27bf8..0cf024c 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -32,7 +32,6 @@ static inline void mapping_set_error(struct address_space *mapping, int error)
 	}
 }
 
-#ifdef CONFIG_UNEVICTABLE_LRU
 #define AS_UNEVICTABLE	(__GFP_BITS_SHIFT + 2)	/* e.g., ramdisk, SHM_LOCK */
 
 static inline void mapping_set_unevictable(struct address_space *mapping)
@@ -51,14 +50,6 @@ static inline int mapping_unevictable(struct address_space *mapping)
 		return test_bit(AS_UNEVICTABLE, &mapping->flags);
 	return !!mapping;
 }
-#else
-static inline void mapping_set_unevictable(struct address_space *mapping) { }
-static inline void mapping_clear_unevictable(struct address_space *mapping) { }
-static inline int mapping_unevictable(struct address_space *mapping)
-{
-	return 0;
-}
-#endif
 
 static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
 {
diff --git a/include/linux/swap.h b/include/linux/swap.h
index a3af95b..18c639b 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -233,8 +233,9 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
 }
 #endif
 
-#ifdef CONFIG_UNEVICTABLE_LRU
 extern int page_evictable(struct page *page, struct vm_area_struct *vma);
+
+#ifdef CONFIG_UNEVICTABLE_LRU
 extern void scan_mapping_unevictable_pages(struct address_space *);
 
 extern unsigned long scan_unevictable_pages;
@@ -243,12 +244,6 @@ extern int scan_unevictable_handler(struct ctl_table *, int, struct file *,
 extern int scan_unevictable_register_node(struct node *node);
 extern void scan_unevictable_unregister_node(struct node *node);
 #else
-static inline int page_evictable(struct page *page,
-						struct vm_area_struct *vma)
-{
-	return 1;
-}
-
 static inline void scan_mapping_unevictable_pages(struct address_space *mapping)
 {
 }
-- 
1.5.4.3



> On Thu, 12 Mar 2009 10:04:41 +0900 (JST)
> KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
>
> Hi
> 
> > >> Page reclaim shouldn't be even attempting to reclaim or write back
> > >> ramfs pagecache pages - reclaim can't possibly do anything with these
> > >> pages!
> > >>
> > >> Arguably those pages shouldn't be on the LRU at all, but we haven't
> > >> done that yet.
> > >>
> > >> Now, my problem is that I can't 100% be sure that we _ever_ implemented
> > >> this properly. ?I _think_ we did, in which case we later broke it. ?If
> > >> we've always been (stupidly) trying to pageout these pages then OK, I
> > >> guess your patch is a suitable 2.6.29 stopgap.
> > >
> > > OK, I can't find any code anywhere in which we excluded ramfs pages
> > > from consideration by page reclaim. ?How dumb.
> > 
> > The ramfs  considers it in just CONFIG_UNEVICTABLE_LRU case
> > It that case, ramfs_get_inode calls mapping_set_unevictable.
> > So,  page reclaim can exclude ramfs pages by page_evictable.
> > It's problem .
> 
> Currently, CONFIG_UNEVICTABLE_LRU can't use on nommu machine
> because nobody of vmscan folk havbe nommu machine.
> 
> Yes, it is very stupid reason. _very_ welcome to tester! :)
> 
> 
> 
> David, Could you please try following patch if you have NOMMU machine?
> it is straightforward porting to nommu.
> 
> 
> ==
> Subject: [PATCH] remove to depend on MMU from CONFIG_UNEVICTABLE_LRU
> 
> logically, CONFIG_UNEVICTABLE_LRU doesn't depend on MMU.
> but current code does by mistake. fix it.
> 
> 
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> ---
>  mm/Kconfig |    1 -
>  mm/nommu.c |   24 ++++++++++++++++++++++++
>  2 files changed, 24 insertions(+), 1 deletion(-)
> 
> Index: b/mm/Kconfig
> ===================================================================
> --- a/mm/Kconfig	2008-12-28 20:55:23.000000000 +0900
> +++ b/mm/Kconfig	2008-12-28 21:24:08.000000000 +0900
> @@ -212,7 +212,6 @@ config VIRT_TO_BUS
>  config UNEVICTABLE_LRU
>  	bool "Add LRU list to track non-evictable pages"
>  	default y
> -	depends on MMU
>  	help
>  	  Keeps unevictable pages off of the active and inactive pageout
>  	  lists, so kswapd will not waste CPU time or have its balancing
> Index: b/mm/nommu.c
> ===================================================================
> --- a/mm/nommu.c	2008-12-25 08:26:37.000000000 +0900
> +++ b/mm/nommu.c	2008-12-28 21:29:36.000000000 +0900
> @@ -1521,3 +1521,27 @@ int access_process_vm(struct task_struct
>  	mmput(mm);
>  	return len;
>  }
> +
> +/*
> + *  LRU accounting for clear_page_mlock()
> + */
> +void __clear_page_mlock(struct page *page)
> +{
> +	VM_BUG_ON(!PageLocked(page));
> +
> +	if (!page->mapping) {	/* truncated ? */
> +		return;
> +	}
> +
> +	dec_zone_page_state(page, NR_MLOCK);
> +	count_vm_event(UNEVICTABLE_PGCLEARED);
> +	if (!isolate_lru_page(page)) {
> +		putback_lru_page(page);
> +	} else {
> +		/*
> +		 * We lost the race. the page already moved to evictable list.
> +		 */
> +		if (PageUnevictable(page))
> +			count_vm_event(UNEVICTABLE_PGSTRANDED);
> +	}
> +}
> 
> 
> 
> 


-- 
Kinds Regards
Minchan Kim

  reply	other threads:[~2009-03-12  1:52 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11 15:30 David Howells
2009-03-11 17:26 ` Johannes Weiner
2009-03-11 22:03 ` Andrew Morton
2009-03-11 22:36   ` Johannes Weiner
2009-03-12  0:02   ` Andrew Morton
2009-03-12  0:35     ` Minchan Kim
2009-03-12  1:04       ` KOSAKI Motohiro
2009-03-12  1:52         ` Minchan Kim [this message]
2009-03-12  1:56           ` Minchan Kim
2009-03-12  2:00           ` KOSAKI Motohiro
2009-03-12  2:11             ` Minchan Kim
2009-03-12 12:19         ` Robin Getz
2009-03-12 17:55           ` [uClinux-dev] " Jamie Lokier
2009-03-13 17:33         ` [PATCH 0/2] Make the Unevictable LRU available on NOMMU David Howells
2009-03-13 17:33           ` [PATCH 1/2] NOMMU: There is no mlock() for NOMMU, so don't provide the bits David Howells
2009-03-14 11:17             ` KOSAKI Motohiro
2009-03-13 17:33           ` [PATCH 2/2] NOMMU: Make CONFIG_UNEVICTABLE_LRU available when CONFIG_MMU=n David Howells
2009-03-14 11:17             ` KOSAKI Motohiro
2009-03-14  0:27           ` [PATCH 0/2] Make the Unevictable LRU available on NOMMU Minchan Kim
2009-03-20 16:08             ` Lee Schermerhorn
2009-03-20 16:24             ` David Howells
2009-03-20 18:30               ` Lee Schermerhorn
2009-03-21 10:20                 ` Johannes Weiner
2009-03-22 20:13                   ` [patch 1/3] mm: decouple unevictable lru from mmu Johannes Weiner
2009-03-22 23:46                     ` KOSAKI Motohiro
2009-03-23  0:14                       ` Johannes Weiner
2009-03-23 10:48                       ` David Howells
2009-03-22 20:13                   ` [patch 2/3] ramfs-nommu: use generic lru cache Johannes Weiner
2009-03-23  2:22                     ` KOSAKI Motohiro
2009-03-22 20:13                   ` [patch 3/3] mm: keep pages from unevictable mappings off the LRU lists Johannes Weiner
2009-03-23  0:44                     ` Minchan Kim
2009-03-23  2:21                       ` KOSAKI Motohiro
2009-03-23  8:42                         ` Johannes Weiner
2009-03-23  9:01                           ` KOSAKI Motohiro
2009-03-23  9:23                             ` KOSAKI Motohiro
2009-03-26  0:48                               ` Johannes Weiner
2009-03-23 10:40                   ` [patch 2/3] ramfs-nommu: use generic lru cache David Howells
2009-03-23 10:53                   ` [patch 3/3] mm: keep pages from unevictable mappings off the LRU lists David Howells
2009-03-26  0:01                     ` Johannes Weiner
2009-03-26  8:56                       ` KOSAKI Motohiro
2009-03-26 10:36                         ` Johannes Weiner
2009-03-23 20:07                   ` [PATCH 0/2] Make the Unevictable LRU available on NOMMU Lee Schermerhorn
2009-03-13 11:53       ` [PATCH] NOMMU: Pages allocated to a ramfs inode's pagecache may get wrongly discarded David Howells
2009-03-13 22:49         ` Johannes Weiner
2009-03-12  0:08 ` Andrew Morton
2009-03-12  7:12   ` Berkhan, Enrik (GE Infra, Oil & Gas)
2009-03-12 11:29     ` [uClinux-dev] " Jamie Lokier
2009-03-12 11:50       ` Peter Zijlstra
2009-03-12 23:20         ` Minchan Kim
2009-03-13  7:56           ` Peter Zijlstra
2009-03-13  9:17             ` Minchan Kim
2009-03-12 12:25 ` David Howells
2009-03-12 19:43   ` Andrew Morton
2009-03-13  2:03     ` KOSAKI Motohiro
2009-03-13  7:57       ` Peter Zijlstra
2009-03-13  8:15         ` KOSAKI Motohiro
2009-03-13  9:19           ` Minchan Kim
2009-03-13 10:44           ` Johannes Weiner
2009-03-14 14:29             ` KOSAKI Motohiro

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=20090312105226.88df3f63.minchan.kim@barrios-desktop \
    --to=minchan.kim@gmail.com \
    --cc=Enrik.Berkhan@ge.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=lee.schermerhorn@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=uclinux-dev@uclinux.org \
    /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

all inboxes | Powered by JetHome®