From: Andrew Morton <akpm@linux-foundation.org>
To: js1304@gmail.com
Cc: Vlastimil Babka <vbabka@suse.cz>,
mgorman@techsingularity.net, Minchan Kim <minchan@kernel.org>,
Alexander Potapenko <glider@google.com>,
Hugh Dickins <hughd@google.com>, Michal Hocko <mhocko@kernel.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Sasha Levin <sasha.levin@oracle.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: Re: [PATCH v3 0/9] reduce memory usage by page_owner
Date: Fri, 24 Jun 2016 16:19:35 -0700 [thread overview]
Message-ID: <20160624161935.81bdf2067dfff7cfb44ee68f@linux-foundation.org> (raw)
In-Reply-To: <1466150259-27727-1-git-send-email-iamjoonsoo.kim@lge.com>
On Fri, 17 Jun 2016 16:57:30 +0900 js1304@gmail.com wrote:
> There was a bug reported by Sasha and minor fixes is needed
> so I send v3.
>
> o fix a bg reported by Sasha (mm/compaction: split freepages
> without holding the zone lock)
> o add code comment for todo list (mm/page_owner: use stackdepot
> to store stacktrace) per Michal
> o add 'inline' keyword (mm/page_alloc: introduce post allocation
> processing on page allocator) per Vlastimil
> o add a patch that clean-up code per Vlastimil
I've gone through v3 patches 2-9 and have plucked out the deltas to
take what-i-had and turn that into what-you-sent. Patch 1/9 has seen a
lot of competing churn in isolate_freepages_block(), so please review
the current version of that, below. Between the "===" markers:
static unsigned long isolate_freepages_block(struct compact_control *cc,
unsigned long *start_pfn,
unsigned long end_pfn,
struct list_head *freelist,
bool strict)
{
int nr_scanned = 0, total_isolated = 0;
struct page *cursor, *valid_page = NULL;
unsigned long flags = 0;
bool locked = false;
unsigned long blockpfn = *start_pfn;
unsigned int order;
cursor = pfn_to_page(blockpfn);
/* Isolate free pages. */
for (; blockpfn < end_pfn; blockpfn++, cursor++) {
int isolated;
struct page *page = cursor;
/*
* Periodically drop the lock (if held) regardless of its
* contention, to give chance to IRQs. Abort if fatal signal
* pending or async compaction detects need_resched()
*/
if (!(blockpfn % SWAP_CLUSTER_MAX)
&& compact_unlock_should_abort(&cc->zone->lock, flags,
&locked, cc))
break;
nr_scanned++;
if (!pfn_valid_within(blockpfn))
goto isolate_fail;
if (!valid_page)
valid_page = page;
/*
* For compound pages such as THP and hugetlbfs, we can save
* potentially a lot of iterations if we skip them at once.
* The check is racy, but we can consider only valid values
* and the only danger is skipping too much.
*/
if (PageCompound(page)) {
unsigned int comp_order = compound_order(page);
if (likely(comp_order < MAX_ORDER)) {
blockpfn += (1UL << comp_order) - 1;
cursor += (1UL << comp_order) - 1;
}
goto isolate_fail;
}
if (!PageBuddy(page))
goto isolate_fail;
====================
/*
* If we already hold the lock, we can skip some rechecking.
* Note that if we hold the lock now, checked_pageblock was
* already set in some previous iteration (or strict is true),
* so it is correct to skip the suitable migration target
* recheck as well.
*/
if (!locked) {
/*
* The zone lock must be held to isolate freepages.
* Unfortunately this is a very coarse lock and can be
* heavily contended if there are parallel allocations
* or parallel compactions. For async compaction do not
* spin on the lock and we acquire the lock as late as
* possible.
*/
locked = compact_trylock_irqsave(&cc->zone->lock,
&flags, cc);
if (!locked)
break;
/* Recheck this is a buddy page under lock */
if (!PageBuddy(page))
goto isolate_fail;
}
/* Found a free page, will break it into order-0 pages */
order = page_order(page);
isolated = __isolate_free_page(page, order);
if (!isolated)
break;
set_page_private(page, order);
total_isolated += isolated;
cc->nr_freepages += isolated;
list_add_tail(&page->lru, freelist);
if (!strict && cc->nr_migratepages <= cc->nr_freepages) {
blockpfn += isolated;
break;
}
/* Advance to the end of split page */
blockpfn += isolated - 1;
cursor += isolated - 1;
continue;
isolate_fail:
=====================
if (strict)
break;
else
continue;
}
if (locked)
spin_unlock_irqrestore(&cc->zone->lock, flags);
/*
* There is a tiny chance that we have read bogus compound_order(),
* so be careful to not go outside of the pageblock.
*/
if (unlikely(blockpfn > end_pfn))
blockpfn = end_pfn;
trace_mm_compaction_isolate_freepages(*start_pfn, blockpfn,
nr_scanned, total_isolated);
/* Record how far we have got within the block */
*start_pfn = blockpfn;
/*
* If strict isolation is requested by CMA then check that all the
* pages requested were isolated. If there were any failures, 0 is
* returned and CMA will fail.
*/
if (strict && blockpfn < end_pfn)
total_isolated = 0;
/* Update the pageblock-skip if the whole pageblock was scanned */
if (blockpfn == end_pfn)
update_pageblock_skip(cc, valid_page, total_isolated, false);
count_compact_events(COMPACTFREE_SCANNED, nr_scanned);
if (total_isolated)
count_compact_events(COMPACTISOLATED, total_isolated);
return total_isolated;
}
--
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:[~2016-06-24 23:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-17 7:57 js1304
2016-06-17 7:57 ` [PATCH v3 1/9] mm/compaction: split freepages without holding the zone lock js1304
2016-06-17 7:57 ` [PATCH v3 2/9] mm/page_owner: initialize page owner " js1304
2016-06-17 7:57 ` [PATCH v3 3/9] mm/page_owner: copy last_migrate_reason in copy_page_owner() js1304
2016-06-17 7:57 ` [PATCH v3 4/9] mm/page_owner: introduce split_page_owner and replace manual handling js1304
2016-06-17 7:57 ` [PATCH v3 5/9] tools/vm/page_owner: increase temporary buffer size js1304
2016-06-17 12:56 ` Vlastimil Babka
2016-06-17 7:57 ` [PATCH v3 6/9] mm/page_owner: use stackdepot to store stacktrace js1304
2016-10-26 13:06 ` [v3,6/9] " Sascha Silbe
2016-10-27 0:17 ` Joonsoo Kim
2016-12-22 23:37 ` Sascha Silbe
2016-06-17 7:57 ` [PATCH v3 7/9] mm/page_owner: avoid null pointer dereference js1304
2016-06-17 13:32 ` Vlastimil Babka
2016-06-24 20:19 ` Andrew Morton
2016-06-17 7:57 ` [PATCH v3 8/9] mm/page_alloc: introduce post allocation processing on page allocator js1304
2016-06-17 7:57 ` [PATCH v3 9/9] mm/page_isolation: clean up confused code js1304
2016-06-17 13:34 ` Vlastimil Babka
2016-06-24 23:19 ` Andrew Morton [this message]
2016-06-27 5:45 ` [PATCH v3 0/9] reduce memory usage by page_owner Joonsoo 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=20160624161935.81bdf2067dfff7cfb44ee68f@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=glider@google.com \
--cc=hughd@google.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=js1304@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@kernel.org \
--cc=minchan@kernel.org \
--cc=sasha.levin@oracle.com \
--cc=vbabka@suse.cz \
/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