All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Benjamin LaHaise <bcrl@kvack.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Seth Jennings <sjenning@linux.vnet.ibm.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Mel Gorman <mgorman@suse.de>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Dave Hansen <dave.hansen@intel.com>,
	guz.fnst@cn.fujitsu.com
Subject: Re: [RFC PATCH v2 0/4] mm: reclaim zbud pages on migration and compaction
Date: Mon, 12 Aug 2013 12:49:50 +0900	[thread overview]
Message-ID: <20130812034950.GB18832@bbox> (raw)
In-Reply-To: <20130812031647.GB8043@kvack.org>

Hello Benjamin,

On Sun, Aug 11, 2013 at 11:16:47PM -0400, Benjamin LaHaise wrote:
> Hello Minchan,
> 
> On Mon, Aug 12, 2013 at 11:25:35AM +0900, Minchan Kim wrote:
> > Hello,
> > 
> > On Fri, Aug 09, 2013 at 12:22:16PM +0200, Krzysztof Kozlowski wrote:
> > > Hi,
> > > 
> > > Currently zbud pages are not movable and they cannot be allocated from CMA
> > > region. These patches try to address the problem by:
> > 
> > The zcache, zram and GUP pages for memory-hotplug and/or CMA are
> > same situation.
> > 
> > > 1. Adding a new form of reclaim of zbud pages.
> > > 2. Reclaiming zbud pages during migration and compaction.
> > > 3. Allocating zbud pages with __GFP_RECLAIMABLE flag.
> > 
> > So I'd like to solve it with general approach.
> > 
> > Each subsystem or GUP caller who want to pin pages long time should
> > create own migration handler and register the page into pin-page
> > control subsystem like this.
> > 
> > driver/foo.c
> > 
> > int foo_migrate(struct page *page, void *private);
> > 
> > static struct pin_page_owner foo_migrate = {
> >         .migrate = foo_migrate;
> > };
> > 
> > int foo_allocate()
> > {
> >         struct page *newpage = alloc_pages();
> >         set_pinned_page(newpage, &foo_migrate);
> > }
> > 
> > And in compaction.c or somewhere where want to move/reclaim the page,
> > general VM can ask to owner if it founds it's pinned page.
> > 
> > mm/compaction.c
> > 
> >         if (PagePinned(page)) {
> >                 struct pin_page_info *info = get_page_pin_info(page);
> >                 info->migrate(page);
> >                 
> >         }
> > 
> > Only hurdle for that is that we should introduce a new page flag and
> > I believe if we all agree this approch, we can find a solution at last.
> > 
> > What do you think?
> 
> I don't like this approach.  There will be too many collisions in the 
> hash that's been implemented (read: I don't think you can get away with 

Yeb. That's why I'd like to change it with radix tree of pfn as
I mentioned as comment(just used hash for fast prototyping without big
considering).

> a naive implementation for core infrastructure that has to suite all 
> users), you've got a global spin lock, and it doesn't take into account 

I think batching-drain of pinned page would be sufficient for avoiding
global spinlock problem because we have been used it with page-allocator
which is one of most critical hotpath.

> NUMA issues.  The address space migratepage method doesn't have those 

NUMA issues? Could you elaborate it a bit?

> issues (at least where it is usable as in aio's use-case).
> 
> If you're going to go down this path, you'll have to decide if *all* users 
> of pinned pages are going to have to subscribe to supporting the un-pinning 
> of pages, and that means taking a real hard look at how O_DIRECT pins pages.  
> Once you start thinking about that, you'll find that addressing the 
> performance concerns is going to be an essential part of any design work to 
> be done in this area.

True. The patch I included just shows the cocnept so I didn't consider any
performance critical part but if we all agree this arpproch does make sense
and we can implement little overhead, I will step into next phase to enhance
performance.

Thanks for the input, Ben!

> 
> 		-ben
> -- 
> "Thought is the essence of where you are now."
> 
> --
> 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>

-- 
Kind regards,
Minchan Kim

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Benjamin LaHaise <bcrl@kvack.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Seth Jennings <sjenning@linux.vnet.ibm.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Mel Gorman <mgorman@suse.de>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Dave Hansen <dave.hansen@intel.com>,
	guz.fnst@cn.fujitsu.com
Subject: Re: [RFC PATCH v2 0/4] mm: reclaim zbud pages on migration and compaction
Date: Mon, 12 Aug 2013 12:49:50 +0900	[thread overview]
Message-ID: <20130812034950.GB18832@bbox> (raw)
In-Reply-To: <20130812031647.GB8043@kvack.org>

Hello Benjamin,

On Sun, Aug 11, 2013 at 11:16:47PM -0400, Benjamin LaHaise wrote:
> Hello Minchan,
> 
> On Mon, Aug 12, 2013 at 11:25:35AM +0900, Minchan Kim wrote:
> > Hello,
> > 
> > On Fri, Aug 09, 2013 at 12:22:16PM +0200, Krzysztof Kozlowski wrote:
> > > Hi,
> > > 
> > > Currently zbud pages are not movable and they cannot be allocated from CMA
> > > region. These patches try to address the problem by:
> > 
> > The zcache, zram and GUP pages for memory-hotplug and/or CMA are
> > same situation.
> > 
> > > 1. Adding a new form of reclaim of zbud pages.
> > > 2. Reclaiming zbud pages during migration and compaction.
> > > 3. Allocating zbud pages with __GFP_RECLAIMABLE flag.
> > 
> > So I'd like to solve it with general approach.
> > 
> > Each subsystem or GUP caller who want to pin pages long time should
> > create own migration handler and register the page into pin-page
> > control subsystem like this.
> > 
> > driver/foo.c
> > 
> > int foo_migrate(struct page *page, void *private);
> > 
> > static struct pin_page_owner foo_migrate = {
> >         .migrate = foo_migrate;
> > };
> > 
> > int foo_allocate()
> > {
> >         struct page *newpage = alloc_pages();
> >         set_pinned_page(newpage, &foo_migrate);
> > }
> > 
> > And in compaction.c or somewhere where want to move/reclaim the page,
> > general VM can ask to owner if it founds it's pinned page.
> > 
> > mm/compaction.c
> > 
> >         if (PagePinned(page)) {
> >                 struct pin_page_info *info = get_page_pin_info(page);
> >                 info->migrate(page);
> >                 
> >         }
> > 
> > Only hurdle for that is that we should introduce a new page flag and
> > I believe if we all agree this approch, we can find a solution at last.
> > 
> > What do you think?
> 
> I don't like this approach.  There will be too many collisions in the 
> hash that's been implemented (read: I don't think you can get away with 

Yeb. That's why I'd like to change it with radix tree of pfn as
I mentioned as comment(just used hash for fast prototyping without big
considering).

> a naive implementation for core infrastructure that has to suite all 
> users), you've got a global spin lock, and it doesn't take into account 

I think batching-drain of pinned page would be sufficient for avoiding
global spinlock problem because we have been used it with page-allocator
which is one of most critical hotpath.

> NUMA issues.  The address space migratepage method doesn't have those 

NUMA issues? Could you elaborate it a bit?

> issues (at least where it is usable as in aio's use-case).
> 
> If you're going to go down this path, you'll have to decide if *all* users 
> of pinned pages are going to have to subscribe to supporting the un-pinning 
> of pages, and that means taking a real hard look at how O_DIRECT pins pages.  
> Once you start thinking about that, you'll find that addressing the 
> performance concerns is going to be an essential part of any design work to 
> be done in this area.

True. The patch I included just shows the cocnept so I didn't consider any
performance critical part but if we all agree this arpproch does make sense
and we can implement little overhead, I will step into next phase to enhance
performance.

Thanks for the input, Ben!

> 
> 		-ben
> -- 
> "Thought is the essence of where you are now."
> 
> --
> 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>

-- 
Kind regards,
Minchan Kim

  reply	other threads:[~2013-08-12  3:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09 10:22 [RFC PATCH v2 0/4] mm: reclaim zbud pages on migration and compaction Krzysztof Kozlowski
2013-08-09 10:22 ` Krzysztof Kozlowski
2013-08-09 10:22 ` [RFC PATCH v2 1/4] zbud: use page ref counter for zbud pages Krzysztof Kozlowski
2013-08-09 10:22   ` Krzysztof Kozlowski
2013-08-09 10:22 ` [RFC PATCH v2 2/4] mm: split code for unusing swap entries from try_to_unuse Krzysztof Kozlowski
2013-08-09 10:22   ` Krzysztof Kozlowski
2013-08-09 10:22 ` [RFC PATCH v2 3/4] mm: use mapcount for identifying zbud pages Krzysztof Kozlowski
2013-08-09 10:22   ` Krzysztof Kozlowski
2013-08-09 10:22 ` [RFC PATCH v2 4/4] mm: reclaim zbud pages on migration and compaction Krzysztof Kozlowski
2013-08-09 10:22   ` Krzysztof Kozlowski
2013-08-12  2:25 ` [RFC PATCH v2 0/4] " Minchan Kim
2013-08-12  2:25   ` Minchan Kim
2013-08-12  3:16   ` Benjamin LaHaise
2013-08-12  3:16     ` Benjamin LaHaise
2013-08-12  3:49     ` Minchan Kim [this message]
2013-08-12  3:49       ` Minchan Kim
2013-08-12 16:48   ` Dave Hansen
2013-08-12 16:48     ` Dave Hansen

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=20130812034950.GB18832@bbox \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=bcrl@kvack.org \
    --cc=dave.hansen@intel.com \
    --cc=guz.fnst@cn.fujitsu.com \
    --cc=k.kozlowski@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mgorman@suse.de \
    --cc=sjenning@linux.vnet.ibm.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 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.