From: Andrea Arcangeli <aarcange@redhat.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>, Mel Gorman <mel@csn.ul.ie>,
Wu Fengguang <fengguang.wu@intel.com>,
Minchan Kim <minchan.kim@gmail.com>,
Rik van Riel <riel@redhat.com>
Subject: Re: [PATCH 4/7] vmscan: narrowing synchrounous lumply reclaim condition
Date: Wed, 27 Oct 2010 18:41:38 +0200 [thread overview]
Message-ID: <20101027164138.GD29304@random.random> (raw)
In-Reply-To: <20100805151341.31C3.A69D9226@jp.fujitsu.com>
Hi,
On Thu, Aug 05, 2010 at 03:14:13PM +0900, KOSAKI Motohiro wrote:
> @@ -265,6 +271,36 @@ unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
> return ret;
> }
>
> +static void set_lumpy_reclaim_mode(int priority, struct scan_control *sc,
> + bool sync)
> +{
> + enum lumpy_mode mode = sync ? LUMPY_MODE_SYNC : LUMPY_MODE_ASYNC;
> +
> + /*
> + * Some reclaim have alredy been failed. No worth to try synchronous
> + * lumpy reclaim.
> + */
> + if (sync && sc->lumpy_reclaim_mode == LUMPY_MODE_NONE)
> + return;
> +
> + /*
> + * If we need a large contiguous chunk of memory, or have
> + * trouble getting a small set of contiguous pages, we
> + * will reclaim both active and inactive pages.
> + */
> + if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
> + sc->lumpy_reclaim_mode = mode;
> + else if (sc->order && priority < DEF_PRIORITY - 2)
> + sc->lumpy_reclaim_mode = mode;
> + else
> + sc->lumpy_reclaim_mode = LUMPY_MODE_NONE;
> +}
> +
> +static void disable_lumpy_reclaim_mode(struct scan_control *sc)
> +{
> + sc->lumpy_reclaim_mode = LUMPY_MODE_NONE;
> +}
> +
> static inline int is_page_cache_freeable(struct page *page)
> {
> /*
> @@ -275,7 +311,8 @@ static inline int is_page_cache_freeable(struct page *page)
> return page_count(page) - page_has_private(page) == 2;
> }
>
> -static int may_write_to_queue(struct backing_dev_info *bdi)
> +static int may_write_to_queue(struct backing_dev_info *bdi,
> + struct scan_control *sc)
> {
> if (current->flags & PF_SWAPWRITE)
> return 1;
> @@ -283,6 +320,10 @@ static int may_write_to_queue(struct backing_dev_info *bdi)
> return 1;
> if (bdi == current->backing_dev_info)
> return 1;
> +
> + /* lumpy reclaim for hugepage often need a lot of write */
> + if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
> + return 1;
> return 0;
> }
>
> @@ -307,12 +348,6 @@ static void handle_write_error(struct address_space *mapping,
> unlock_page(page);
> }
>
> -/* Request for sync pageout. */
> -enum pageout_io {
> - PAGEOUT_IO_ASYNC,
> - PAGEOUT_IO_SYNC,
> -};
> -
> /* possible outcome of pageout() */
> typedef enum {
> /* failed to write page out, page is locked */
> @@ -330,7 +365,7 @@ typedef enum {
> * Calls ->writepage().
> */
> static pageout_t pageout(struct page *page, struct address_space *mapping,
> - enum pageout_io sync_writeback)
> + struct scan_control *sc)
> {
> /*
> * If the page is dirty, only perform writeback if that write
> @@ -366,8 +401,10 @@ static pageout_t pageout(struct page *page, struct address_space *mapping,
> }
> if (mapping->a_ops->writepage == NULL)
> return PAGE_ACTIVATE;
> - if (!may_write_to_queue(mapping->backing_dev_info))
> + if (!may_write_to_queue(mapping->backing_dev_info, sc)) {
> + disable_lumpy_reclaim_mode(sc);
> return PAGE_KEEP;
> + }
>
> if (clear_page_dirty_for_io(page)) {
> int res;
> @@ -394,7 +431,8 @@ static pageout_t pageout(struct page *page, struct address_space *mapping,
> * direct reclaiming a large contiguous area and the
> * first attempt to free a range of pages fails.
> */
> - if (PageWriteback(page) && sync_writeback == PAGEOUT_IO_SYNC)
> + if (PageWriteback(page) &&
> + sc->lumpy_reclaim_mode == LUMPY_MODE_SYNC)
> wait_on_page_writeback(page);
>
> if (!PageWriteback(page)) {
> @@ -402,7 +440,7 @@ static pageout_t pageout(struct page *page, struct address_space *mapping,
> ClearPageReclaim(page);
> }
> trace_mm_vmscan_writepage(page,
> - sync_writeback == PAGEOUT_IO_SYNC);
> + sc->lumpy_reclaim_mode == LUMPY_MODE_SYNC);
> inc_zone_page_state(page, NR_VMSCAN_WRITE);
> return PAGE_SUCCESS;
> }
> @@ -580,7 +618,7 @@ static enum page_references page_check_references(struct page *page,
> referenced_page = TestClearPageReferenced(page);
>
> /* Lumpy reclaim - ignore references */
> - if (sc->lumpy_reclaim_mode)
> + if (sc->lumpy_reclaim_mode != LUMPY_MODE_NONE)
> return PAGEREF_RECLAIM;
>
> /*
> @@ -644,8 +682,7 @@ static noinline_for_stack void free_page_list(struct list_head *free_pages)
> * shrink_page_list() returns the number of reclaimed pages
> */
> static unsigned long shrink_page_list(struct list_head *page_list,
> - struct scan_control *sc,
> - enum pageout_io sync_writeback)
> + struct scan_control *sc)
> {
> LIST_HEAD(ret_pages);
> LIST_HEAD(free_pages);
> @@ -665,7 +702,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
> page = lru_to_page(page_list);
> list_del(&page->lru);
>
> - if (sync_writeback == PAGEOUT_IO_SYNC)
> + if (sc->lumpy_reclaim_mode == LUMPY_MODE_SYNC)
> lock_page(page);
> else if (!trylock_page(page))
> goto keep;
> @@ -696,10 +733,13 @@ static unsigned long shrink_page_list(struct list_head *page_list,
> * for any page for which writeback has already
> * started.
> */
> - if (sync_writeback == PAGEOUT_IO_SYNC && may_enter_fs)
> + if (sc->lumpy_reclaim_mode == LUMPY_MODE_SYNC &&
> + may_enter_fs)
> wait_on_page_writeback(page);
> - else
> - goto keep_locked;
> + else {
> + unlock_page(page);
> + goto keep_lumpy;
> + }
> }
>
> references = page_check_references(page, sc);
[...]
this rejects on THP code, lumpy is unusable with hugepages, it grinds
the system to an halt, and there's no reason to let it survive. Lumpy
is like compaction done with an hammer while blindfolded.
I don't know why community insists on improving lumpy when it has to
be removed completely, especially now that we have memory compaction.
I'll keep deleting on my tree...
I hope lumpy work stops here and that it goes away whenever THP is
merged.
Thanks,
Andrea
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-10-27 16:42 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-05 6:11 [RFC][PATCH 0/7] low latency synchrounous lumpy reclaim KOSAKI Motohiro
2010-08-05 6:12 ` [PATCH 1/7] vmscan: raise the bar to PAGEOUT_IO_SYNC stalls KOSAKI Motohiro
2010-08-05 15:02 ` Mel Gorman
2010-08-08 6:42 ` KOSAKI Motohiro
2010-08-05 15:19 ` Rik van Riel
2010-08-05 6:13 ` [PATCH 2/7] vmscan: synchronous lumpy reclaim don't call congestion_wait() KOSAKI Motohiro
2010-08-05 13:55 ` Minchan Kim
2010-08-05 15:05 ` Rik van Riel
2010-08-05 15:06 ` Mel Gorman
2010-08-05 6:13 ` [PATCH 3/7] vmscan: synchrounous lumpy reclaim use lock_page() instead trylock_page() KOSAKI Motohiro
2010-08-05 14:17 ` Minchan Kim
2010-08-06 0:52 ` Minchan Kim
2010-08-05 15:12 ` Mel Gorman
2010-08-05 15:26 ` Rik van Riel
2010-08-05 6:14 ` [PATCH 4/7] vmscan: narrowing synchrounous lumply reclaim condition KOSAKI Motohiro
2010-08-05 14:59 ` Minchan Kim
2010-10-27 16:41 ` Andrea Arcangeli [this message]
2010-10-27 17:16 ` Mel Gorman
2010-10-27 18:03 ` Andrea Arcangeli
2010-10-28 8:00 ` KOSAKI Motohiro
2010-10-28 15:12 ` Andrea Arcangeli
2010-10-29 2:23 ` KOSAKI Motohiro
2010-10-28 10:20 ` Mel Gorman
2010-11-02 2:04 ` Wu Fengguang
2010-10-28 2:31 ` Ed Tomlinson
2010-10-28 15:22 ` Andrea Arcangeli
2010-08-05 6:14 ` [PATCH 5/7] vmscan: kill dead code in shrink_inactive_list() KOSAKI Motohiro
2010-08-05 15:08 ` Minchan Kim
2010-08-05 15:14 ` Mel Gorman
2010-08-05 6:15 ` [PATCH 6/7] vmscan: remove PF_SWAPWRITE from __zone_reclaim() KOSAKI Motohiro
2010-08-05 6:16 ` [PATCH 7/7] vmscan: isolated_lru_pages() stop neighbor search if neighbor can't be isolated KOSAKI Motohiro
2010-08-05 15:25 ` Mel Gorman
2010-08-05 15:40 ` Minchan Kim
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=20101027164138.GD29304@random.random \
--to=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=fengguang.wu@intel.com \
--cc=hannes@cmpxchg.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
--cc=minchan.kim@gmail.com \
--cc=riel@redhat.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;
as well as URLs for NNTP newsgroup(s).