[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1345589581.13492.259.camel@schen9-DESK>
Date: Tue, 21 Aug 2012 15:53:01 -0700
From: Tim Chen <tim.c.chen@...ux.intel.com>
To: Matthew Wilcox <willy@...ux.intel.com>
Cc: Mel Gorman <mel@....ul.ie>,
Andrew Morton <akpm@...ux-foundation.org>,
Minchan Kim <minchan@...nel.org>,
Johannes Weiner <hannes@...xchg.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Andi Kleen <ak@...ux.intel.com>, linux-mm@...ck.org,
linux-kernel <linux-kernel@...r.kernel.org>,
Alex Shi <alex.shi@...el.com>
Subject: Re: [RFC PATCH 2/2] mm: Batch page_check_references in
shrink_page_list sharing the same i_mmap_mutex
On Tue, 2012-08-21 at 09:21 -0400, Matthew Wilcox wrote:
>
> The only clunky bit would seem to be this bit:
>
> > if (page_mapped(page) && mapping) {
> > - switch (try_to_unmap(page, TTU_UNMAP)) {
> > + switch (try_to_unmap(page, TTU_UNMAP,
> > + mmap_mutex_locked)) {
>
> Which I think has to look like this:
>
> if (page_mapped(page) && mapping) {
> - switch (try_to_unmap(page, TTU_UNMAP)) {
> + int result;
> + if (i_mmap_mutex)
> + result = __try_to_unmap(page, TTU_UNMAP);
> + else
> + result = try_to_unmap(page, TTU_UNMAP);
> + switch (result) {
>
I think
- switch (try_to_unmap(page, TTU_UNMAP)) {
+ switch (__try_to_unmap(page, TTU_UNMAP)) {
should be enough when your changes are adopted. Because if the page
mmap mutex needs to be locked, we will have locked it here before
__try_to_unmap gets used.
+ if (needs_page_mmap_mutex(page) &&
+ i_mmap_mutex != &page->mapping->i_mmap_mutex) {
+ if (i_mmap_mutex)
+ mutex_unlock(i_mmap_mutex);
+ i_mmap_mutex = &page->mapping->i_mmap_mutex;
+ mutex_lock(i_mmap_mutex);
+ }
Tim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists