From: Andrew Morton <akpm@linux-foundation.org>
To: Daniel Kiper <dkiper@net-space.pl>
Cc: ian.campbell@citrix.com, andi.kleen@intel.com,
haicheng.li@linux.intel.com, fengguang.wu@intel.com,
jeremy@goop.org, konrad.wilk@oracle.com,
dan.magenheimer@oracle.com, v.tolstov@selfip.ru, pasik@iki.fi,
dave@linux.vnet.ibm.com, wdauchy@gmail.com, rientjes@google.com,
xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH 3/3] mm: Extend memory hotplug API to allow memory hotplug in virtual machines
Date: Tue, 29 Mar 2011 12:15:41 -0700 [thread overview]
Message-ID: <20110329121541.d9a27c2e.akpm@linux-foundation.org> (raw)
In-Reply-To: <20110329185913.GF30387@router-fw-old.local.net-space.pl>
On Tue, 29 Mar 2011 20:59:13 +0200
Daniel Kiper <dkiper@net-space.pl> wrote:
> > This is a bit strange. Normally we'll use a notifier chain to tell
> > listeners "hey, X just happened". But this code is different - it
> > instead uses a notifier chain to tell handlers "hey, do X". Where in
> > this case, X is "free a page".
> >
> > And this (ab)use of notifiers is not a good fit! Because we have the
> > obvious problem that if there are three registered noftifiers, we don't
> > want to be freeing the page three times. Hence the tricks with
> > notifier callout return values.
> >
> > If there are multiple independent notifier handlers, how do we manage
> > their priorities? And what are the effects of the ordering of the
> > registration calls?
> >
> > And when one callback overrides an existing one, is there any point in
> > leaving the original one installed at all?
> >
> > I dunno, it's all a bit confusing and strange. Perhaps it would help
> > if you were to explain exactly what behaviour you want here, and we can
> > look to see if there is a more idiomatic way of doing it.
>
> OK. I am looking for simple generic mechanism which allow runtime
> registration/unregistration of generic or module specific (in that
> case Xen) page onlining function. Dave Hansen sugested compile time
> solution (https://lkml.org/lkml/2011/2/8/235), however, it does not
> fit well in my new project on which I am working on (I am going post
> details at the end of April).
Well, without a complete description of what you're trying to do and
without any indication of what "does not fit well" means, I'm at a bit
of a loss to suggest anything.
If we are assured that only one callback will ever be registered at a
time then a simple
typdef void (*callback_t)(struct page *);
static callback_t g_callback;
int register_callback(callback_t callback)
{
int ret = -EINVAL;
lock(some_lock);
if (g_callback == NULL) {
g_callback = callback;
ret = 0;
}
unlock(some_lock)
return ret;
}
would suffice. That's rather nasty because calls to (*g_callback)
require some_lock. Use RCU.
> > Also... I don't think we need (the undocumented)
> > OP_DO_NOT_INCREMENT_TOTAL_COUNTERS and OP_INCREMENT_TOTAL_COUNTERS.
> > Just do
> >
> > void __online_page_increment_counters(struct page *page,
> > bool inc_total_counters);
> >
> > and pass it "true" or false".
>
> What do you think about __online_page_increment_counters()
> (totalram_pages and totalhigh_pages) and
> __online_page_set_limits() (num_physpages and max_mapnr) ???
I don't understand the proposal.
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Daniel Kiper <dkiper@net-space.pl>
Cc: ian.campbell@citrix.com, andi.kleen@intel.com,
haicheng.li@linux.intel.com, fengguang.wu@intel.com,
jeremy@goop.org, konrad.wilk@oracle.com,
dan.magenheimer@oracle.com, v.tolstov@selfip.ru, pasik@iki.fi,
dave@linux.vnet.ibm.com, wdauchy@gmail.com, rientjes@google.com,
xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH 3/3] mm: Extend memory hotplug API to allow memory hotplug in virtual machines
Date: Tue, 29 Mar 2011 12:15:41 -0700 [thread overview]
Message-ID: <20110329121541.d9a27c2e.akpm@linux-foundation.org> (raw)
In-Reply-To: <20110329185913.GF30387@router-fw-old.local.net-space.pl>
On Tue, 29 Mar 2011 20:59:13 +0200
Daniel Kiper <dkiper@net-space.pl> wrote:
> > This is a bit strange. Normally we'll use a notifier chain to tell
> > listeners "hey, X just happened". But this code is different - it
> > instead uses a notifier chain to tell handlers "hey, do X". Where in
> > this case, X is "free a page".
> >
> > And this (ab)use of notifiers is not a good fit! Because we have the
> > obvious problem that if there are three registered noftifiers, we don't
> > want to be freeing the page three times. Hence the tricks with
> > notifier callout return values.
> >
> > If there are multiple independent notifier handlers, how do we manage
> > their priorities? And what are the effects of the ordering of the
> > registration calls?
> >
> > And when one callback overrides an existing one, is there any point in
> > leaving the original one installed at all?
> >
> > I dunno, it's all a bit confusing and strange. Perhaps it would help
> > if you were to explain exactly what behaviour you want here, and we can
> > look to see if there is a more idiomatic way of doing it.
>
> OK. I am looking for simple generic mechanism which allow runtime
> registration/unregistration of generic or module specific (in that
> case Xen) page onlining function. Dave Hansen sugested compile time
> solution (https://lkml.org/lkml/2011/2/8/235), however, it does not
> fit well in my new project on which I am working on (I am going post
> details at the end of April).
Well, without a complete description of what you're trying to do and
without any indication of what "does not fit well" means, I'm at a bit
of a loss to suggest anything.
If we are assured that only one callback will ever be registered at a
time then a simple
typdef void (*callback_t)(struct page *);
static callback_t g_callback;
int register_callback(callback_t callback)
{
int ret = -EINVAL;
lock(some_lock);
if (g_callback == NULL) {
g_callback = callback;
ret = 0;
}
unlock(some_lock)
return ret;
}
would suffice. That's rather nasty because calls to (*g_callback)
require some_lock. Use RCU.
> > Also... I don't think we need (the undocumented)
> > OP_DO_NOT_INCREMENT_TOTAL_COUNTERS and OP_INCREMENT_TOTAL_COUNTERS.
> > Just do
> >
> > void __online_page_increment_counters(struct page *page,
> > bool inc_total_counters);
> >
> > and pass it "true" or false".
>
> What do you think about __online_page_increment_counters()
> (totalram_pages and totalhigh_pages) and
> __online_page_set_limits() (num_physpages and max_mapnr) ???
I don't understand the proposal.
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-03-29 19:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-28 9:25 [PATCH 3/3] mm: Extend memory hotplug API to allow memory hotplug in virtual machines Daniel Kiper
2011-03-28 9:25 ` Daniel Kiper
2011-03-28 16:25 ` Dave Hansen
2011-03-28 16:25 ` Dave Hansen
2011-03-29 18:32 ` Daniel Kiper
2011-03-29 18:32 ` Daniel Kiper
2011-03-30 14:26 ` Dave Hansen
2011-03-30 14:26 ` Dave Hansen
2011-03-28 22:37 ` Andrew Morton
2011-03-28 22:37 ` Andrew Morton
2011-03-29 13:23 ` Konrad Rzeszutek Wilk
2011-03-29 13:23 ` Konrad Rzeszutek Wilk
2011-03-29 18:59 ` Daniel Kiper
2011-03-29 18:59 ` Daniel Kiper
2011-03-29 19:15 ` Andrew Morton [this message]
2011-03-29 19:15 ` Andrew Morton
2011-03-29 20:33 ` Dave Hansen
2011-03-29 20:33 ` Dave Hansen
2011-03-29 21:53 ` Daniel Kiper
2011-03-29 21:53 ` Daniel Kiper
-- strict thread matches above, loose matches on Subject: below --
2011-03-28 9:25 Daniel Kiper
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=20110329121541.d9a27c2e.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=andi.kleen@intel.com \
--cc=dan.magenheimer@oracle.com \
--cc=dave@linux.vnet.ibm.com \
--cc=dkiper@net-space.pl \
--cc=fengguang.wu@intel.com \
--cc=haicheng.li@linux.intel.com \
--cc=ian.campbell@citrix.com \
--cc=jeremy@goop.org \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasik@iki.fi \
--cc=rientjes@google.com \
--cc=v.tolstov@selfip.ru \
--cc=wdauchy@gmail.com \
--cc=xen-devel@lists.xensource.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.