From: Vlastimil Babka <vbabka@suse.cz> To: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: David Rientjes <rientjes@google.com>, Andrew Morton <akpm@linux-foundation.org>, Aaron Lu <aaron.lu@intel.com>, Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 2/2] mm/compaction: speed up pageblock_pfn_to_page() when zone is contiguous Date: Mon, 4 Jan 2016 13:38:02 +0100 [thread overview] Message-ID: <568A67AA.3050603@suse.cz> (raw) In-Reply-To: <20151223065727.GA9691@js1304-P5Q-DELUXE> On 12/23/2015 07:57 AM, Joonsoo Kim wrote: >>> What are the cases where pageblock_pfn_to_page() is used for a subset of >>> the pageblock and the result would be problematic for compaction? I.e., >>> do we actually care to use pageblocks that are not contiguous at all? >> >> The problematic pageblocks are those that have pages from more than one zone in >> them, so we just skip them. Supposedly that can only happen by switching once >> between two zones somewhere in the middle of the pageblock, so it's sufficient >> to check first and last pfn and compare their zones. So using >> pageblock_pfn_to_page() on a subset from compaction would be wrong. Holes (==no >> pages) within pageblock is a different thing checked by pfn_valid_within() >> (#defined out on archs where such holes cannot happen) when scanning the block. >> >> That's why I'm not entirely happy with how the patch conflates both the >> first/last pfn's zone checks and pfn_valid_within() checks. Yes, a fully >> contiguous zone does *imply* that pageblock_pfn_to_page() doesn't have to check >> first/last pfn for a matching zone. But it's not *equality*. And any (now just >> *potential*) user of pageblock_pfn_to_page() with pfn's different than >> first/last pfn of a pageblock is likely wrong. > > Now, I understand your concern. What makes me mislead is that > 3 of 4 callers to pageblock_pfn_to_page() in compaction.c could call it with > non-pageblock boundary pfn. Oh, I thought you were talking about potential new callers, now that the function was exported. So let's see about the existing callers: isolate_migratepages() - first pfn can be non-boundary when restarting from a middle of pageblock, that's true. But it means the pageblock has already passed the check in previous call where it was boundary, so it's safe. Worst can happen that the restarting pfn will be in a intra-pageblock hole so pageblock will be falsely skipped over. isolate_freepages() - always boundary AFAICS? isolate_migratepages_range() and isolate_freepages_range() - yeah the CMA parts say it doesn't have to be aligned, I don't know about actual users > Maybe, they should be fixed first. It would be probably best, even for isolate_migratepages() for consistency and less-surprisibility. > Then, yes. I can > separate first/last pfn's zone checks and pfn_valid_within() checks. > If then, would you be entirely happy? :) Maybe, if the patch also made me a coffee :P > Thanks. Thanks!
WARNING: multiple messages have this Message-ID (diff)
From: Vlastimil Babka <vbabka@suse.cz> To: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: David Rientjes <rientjes@google.com>, Andrew Morton <akpm@linux-foundation.org>, Aaron Lu <aaron.lu@intel.com>, Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 2/2] mm/compaction: speed up pageblock_pfn_to_page() when zone is contiguous Date: Mon, 4 Jan 2016 13:38:02 +0100 [thread overview] Message-ID: <568A67AA.3050603@suse.cz> (raw) In-Reply-To: <20151223065727.GA9691@js1304-P5Q-DELUXE> On 12/23/2015 07:57 AM, Joonsoo Kim wrote: >>> What are the cases where pageblock_pfn_to_page() is used for a subset of >>> the pageblock and the result would be problematic for compaction? I.e., >>> do we actually care to use pageblocks that are not contiguous at all? >> >> The problematic pageblocks are those that have pages from more than one zone in >> them, so we just skip them. Supposedly that can only happen by switching once >> between two zones somewhere in the middle of the pageblock, so it's sufficient >> to check first and last pfn and compare their zones. So using >> pageblock_pfn_to_page() on a subset from compaction would be wrong. Holes (==no >> pages) within pageblock is a different thing checked by pfn_valid_within() >> (#defined out on archs where such holes cannot happen) when scanning the block. >> >> That's why I'm not entirely happy with how the patch conflates both the >> first/last pfn's zone checks and pfn_valid_within() checks. Yes, a fully >> contiguous zone does *imply* that pageblock_pfn_to_page() doesn't have to check >> first/last pfn for a matching zone. But it's not *equality*. And any (now just >> *potential*) user of pageblock_pfn_to_page() with pfn's different than >> first/last pfn of a pageblock is likely wrong. > > Now, I understand your concern. What makes me mislead is that > 3 of 4 callers to pageblock_pfn_to_page() in compaction.c could call it with > non-pageblock boundary pfn. Oh, I thought you were talking about potential new callers, now that the function was exported. So let's see about the existing callers: isolate_migratepages() - first pfn can be non-boundary when restarting from a middle of pageblock, that's true. But it means the pageblock has already passed the check in previous call where it was boundary, so it's safe. Worst can happen that the restarting pfn will be in a intra-pageblock hole so pageblock will be falsely skipped over. isolate_freepages() - always boundary AFAICS? isolate_migratepages_range() and isolate_freepages_range() - yeah the CMA parts say it doesn't have to be aligned, I don't know about actual users > Maybe, they should be fixed first. It would be probably best, even for isolate_migratepages() for consistency and less-surprisibility. > Then, yes. I can > separate first/last pfn's zone checks and pfn_valid_within() checks. > If then, would you be entirely happy? :) Maybe, if the patch also made me a coffee :P > Thanks. Thanks! -- 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-01-04 12:38 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-12-21 6:13 [PATCH 1/2] mm/compaction: fix invalid free_pfn and compact_cached_free_pfn Joonsoo Kim 2015-12-21 6:13 ` Joonsoo Kim 2015-12-21 6:13 ` [PATCH 2/2] mm/compaction: speed up pageblock_pfn_to_page() when zone is contiguous Joonsoo Kim 2015-12-21 6:13 ` Joonsoo Kim 2015-12-21 10:46 ` Vlastimil Babka 2015-12-21 10:46 ` Vlastimil Babka 2015-12-21 12:18 ` Joonsoo Kim 2015-12-21 12:18 ` Joonsoo Kim 2015-12-21 12:38 ` Joonsoo Kim 2015-12-21 12:38 ` Joonsoo Kim 2015-12-22 22:17 ` David Rientjes 2015-12-22 22:17 ` David Rientjes 2015-12-23 6:14 ` Vlastimil Babka 2015-12-23 6:14 ` Vlastimil Babka 2015-12-23 6:57 ` Joonsoo Kim 2015-12-23 6:57 ` Joonsoo Kim 2016-01-04 12:38 ` Vlastimil Babka [this message] 2016-01-04 12:38 ` Vlastimil Babka 2016-01-08 2:52 ` Joonsoo Kim 2016-01-08 2:52 ` Joonsoo Kim 2016-01-19 8:29 ` zhong jiang 2016-01-19 8:29 ` zhong jiang 2015-12-22 22:05 ` [PATCH 1/2] mm/compaction: fix invalid free_pfn and compact_cached_free_pfn David Rientjes 2015-12-22 22:05 ` David Rientjes -- strict thread matches above, loose matches on Subject: below -- 2015-12-14 5:02 Joonsoo Kim 2015-12-14 5:02 ` [PATCH 2/2] mm/compaction: speed up pageblock_pfn_to_page() when zone is contiguous Joonsoo Kim 2015-12-14 5:02 ` Joonsoo Kim 2015-12-14 10:29 ` Vlastimil Babka 2015-12-14 10:29 ` Vlastimil Babka 2015-12-14 15:25 ` Joonsoo Kim 2015-12-14 15:25 ` Joonsoo Kim 2015-12-15 1:06 ` Aaron Lu 2015-12-15 1:06 ` Aaron Lu 2015-12-15 8:24 ` Vlastimil Babka 2015-12-15 8:24 ` Vlastimil Babka
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=568A67AA.3050603@suse.cz \ --to=vbabka@suse.cz \ --cc=aaron.lu@intel.com \ --cc=akpm@linux-foundation.org \ --cc=iamjoonsoo.kim@lge.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mgorman@suse.de \ --cc=riel@redhat.com \ --cc=rientjes@google.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.