All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rafael Aquini <aquini@redhat.com>
To: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Konstantin Khlebnikov <k.khlebnikov@samsung.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Sasha Levin <sasha.levin@oracle.com>,
	Andrey Ryabinin <ryabinin.a.a@gmail.com>
Subject: Re: [PATCH 7/7] mm/balloon_compaction: general cleanup
Date: Thu, 21 Aug 2014 09:31:58 -0300	[thread overview]
Message-ID: <20140821123157.GA19986@optiplex.redhat.com> (raw)
In-Reply-To: <CALYGNiN+MZO42FLhpeyGXhs6a8MRPDDgKfngusWdfNV3r_C0dw@mail.gmail.com>

On Thu, Aug 21, 2014 at 11:30:59AM +0400, Konstantin Khlebnikov wrote:
> On Thu, Aug 21, 2014 at 3:58 AM, Rafael Aquini <aquini@redhat.com> wrote:
> > On Wed, Aug 20, 2014 at 07:05:09PM +0400, Konstantin Khlebnikov wrote:
> >> * move special branch for balloon migraion into migrate_pages
> >> * remove special mapping for balloon and its flag AS_BALLOON_MAP
> >> * embed struct balloon_dev_info into struct virtio_balloon
> >> * cleanup balloon_page_dequeue, kill balloon_page_free
> >>
> >> Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
> >> ---
> >>  drivers/virtio/virtio_balloon.c    |   77 ++++---------
> >>  include/linux/balloon_compaction.h |  107 ++++++------------
> >>  include/linux/migrate.h            |   11 --
> >>  include/linux/pagemap.h            |   18 ---
> >>  mm/balloon_compaction.c            |  214 ++++++++++++------------------------
> >>  mm/migrate.c                       |   27 +----
> >>  6 files changed, 130 insertions(+), 324 deletions(-)
> >>
> > Very nice clean-up, just as all other patches in this set.
> > Please, just consider amending the following changes to this patch of yours
> 
> Well. Probably it's better to hide __Set/Clear inside mm/balloon_compaction.c
> it very unlikely that they might  be used by somebody else.
> mm.h contains too many obscure static inlines and other barely used stuff.
>
Although I agree that very few codesites will actually resort to them,
I believe there's no argument to hide __Set/Clear if PageBalloon() itself is there.
Take a look into how many codesites __{Set,Clear}PageBuddy are being
called -- (as in their Balloon counterpart, just 1 codesite each).

For the sake of consistency and ease of maintainability, either leave all
BalloonPage() and friends at mm.h or move them all out, 
hiding them in balloon_compaction.h.

> And it's worth to rename balloon_compaction.c/h into just balloon.c or
> memory_balloon because
> it provides generic balloon wtihout compaction too. Any objections?
>
No objections here, I was actually thinking about renaming them too.

--
Rafael
 
> >
> > Rafael
> > ---
> >
> > diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
> > index dc7073b..569cf96 100644
> > --- a/include/linux/balloon_compaction.h
> > +++ b/include/linux/balloon_compaction.h
> > @@ -75,41 +75,6 @@ extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info);
> >  #ifdef CONFIG_BALLOON_COMPACTION
> >  extern bool balloon_page_isolate(struct page *page);
> >  extern void balloon_page_putback(struct page *page);
> > -
> > -/*
> > - * balloon_page_insert - insert a page into the balloon's page list and make
> > - *                      the page->mapping assignment accordingly.
> > - * @page    : page to be assigned as a 'balloon page'
> > - * @mapping : allocated special 'balloon_mapping'
> > - * @head    : balloon's device page list head
> > - *
> > - * Caller must ensure the page is locked and the spin_lock protecting balloon
> > - * pages list is held before inserting a page into the balloon device.
> > - */
> > -static inline void
> > -balloon_page_insert(struct balloon_dev_info *balloon, struct page *page)
> > -{
> > -       __SetPageBalloon(page);
> > -       set_page_private(page, (unsigned long)balloon);
> > -       list_add(&page->lru, &balloon->pages);
> > -}
> > -
> > -/*
> > - * balloon_page_delete - delete a page from balloon's page list and clear
> > - *                      the page->mapping assignement accordingly.
> > - * @page    : page to be released from balloon's page list
> > - *
> > - * Caller must ensure the page is locked and the spin_lock protecting balloon
> > - * pages list is held before deleting a page from the balloon device.
> > - */
> > -static inline void balloon_page_delete(struct page *page, bool isolated)
> > -{
> > -       __ClearPageBalloon(page);
> > -       set_page_private(page, 0);
> > -       if (!isolated)
> > -               list_del(&page->lru);
> > -}
> > -
> >  int balloon_page_migrate(new_page_t get_new_page, free_page_t put_new_page,
> >                 unsigned long private, struct page *page,
> >                 int force, enum migrate_mode mode);
> > @@ -130,31 +95,6 @@ static inline gfp_t balloon_mapping_gfp_mask(void)
> >
> >  #else /* !CONFIG_BALLOON_COMPACTION */
> >
> > -static inline void *balloon_mapping_alloc(void *balloon_device,
> > -                               const struct address_space_operations *a_ops)
> > -{
> > -       return ERR_PTR(-EOPNOTSUPP);
> > -}
> > -
> > -static inline void balloon_mapping_free(struct address_space *balloon_mapping)
> > -{
> > -       return;
> > -}
> > -
> > -static inline void
> > -balloon_page_insert(struct balloon_dev_info *balloon, struct page *page)
> > -{
> > -       __SetPageBalloon(page);
> > -       list_add(&page->lru, head);
> > -}
> > -
> > -static inline void balloon_page_delete(struct page *page, bool isolated)
> > -{
> > -       __ClearPageBalloon(page);
> > -       if (!isolated)
> > -               list_del(&page->lru);
> > -}
> > -
> >  static inline int balloon_page_migrate(new_page_t get_new_page,
> >                 free_page_t put_new_page, unsigned long private,
> >                 struct page *page, int force, enum migrate_mode mode)
> > @@ -176,6 +116,46 @@ static inline gfp_t balloon_mapping_gfp_mask(void)
> >  {
> >         return GFP_HIGHUSER;
> >  }
> > -
> >  #endif /* CONFIG_BALLOON_COMPACTION */
> > +
> > +/*
> > + * balloon_page_insert - insert a page into the balloon's page list and make
> > + *                      the page->mapping assignment accordingly.
> > + * @page    : page to be assigned as a 'balloon page'
> > + * @mapping : allocated special 'balloon_mapping'
> > + * @head    : balloon's device page list head
> > + *
> > + * Caller must ensure the page is locked and the spin_lock protecting balloon
> > + * pages list is held before inserting a page into the balloon device.
> > + */
> > +static inline void
> > +balloon_page_insert(struct balloon_dev_info *balloon, struct page *page)
> > +{
> > +#ifdef CONFIG_MEMORY_BALLOON
> > +       __SetPageBalloon(page);
> > +       set_page_private(page, (unsigned long)balloon);
> > +       list_add(&page->lru, &balloon->pages);
> > +       inc_zone_page_state(page, NR_BALLOON_PAGES);
> > +#endif
> > +}
> > +
> > +/*
> > + * balloon_page_delete - delete a page from balloon's page list and clear
> > + *                      the page->mapping assignement accordingly.
> > + * @page    : page to be released from balloon's page list
> > + *
> > + * Caller must ensure the page is locked and the spin_lock protecting balloon
> > + * pages list is held before deleting a page from the balloon device.
> > + */
> > +static inline void balloon_page_delete(struct page *page, bool isolated)
> > +{
> > +#ifdef CONFIG_MEMORY_BALLOON
> > +       __ClearPageBalloon(page);
> > +       set_page_private(page, 0);
> > +       if (!isolated)
> > +               list_del(&page->lru);
> > +       dec_zone_page_state(page, NR_BALLOON_PAGES);
> > +#endif
> > +}
> > +
> >  #endif /* _LINUX_BALLOON_COMPACTION_H */
> > --
> > 1.9.3
> >
> > --
> > 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>

--
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: Rafael Aquini <aquini@redhat.com>
To: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Konstantin Khlebnikov <k.khlebnikov@samsung.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Sasha Levin <sasha.levin@oracle.com>,
	Andrey Ryabinin <ryabinin.a.a@gmail.com>
Subject: Re: [PATCH 7/7] mm/balloon_compaction: general cleanup
Date: Thu, 21 Aug 2014 09:31:58 -0300	[thread overview]
Message-ID: <20140821123157.GA19986@optiplex.redhat.com> (raw)
In-Reply-To: <CALYGNiN+MZO42FLhpeyGXhs6a8MRPDDgKfngusWdfNV3r_C0dw@mail.gmail.com>

On Thu, Aug 21, 2014 at 11:30:59AM +0400, Konstantin Khlebnikov wrote:
> On Thu, Aug 21, 2014 at 3:58 AM, Rafael Aquini <aquini@redhat.com> wrote:
> > On Wed, Aug 20, 2014 at 07:05:09PM +0400, Konstantin Khlebnikov wrote:
> >> * move special branch for balloon migraion into migrate_pages
> >> * remove special mapping for balloon and its flag AS_BALLOON_MAP
> >> * embed struct balloon_dev_info into struct virtio_balloon
> >> * cleanup balloon_page_dequeue, kill balloon_page_free
> >>
> >> Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
> >> ---
> >>  drivers/virtio/virtio_balloon.c    |   77 ++++---------
> >>  include/linux/balloon_compaction.h |  107 ++++++------------
> >>  include/linux/migrate.h            |   11 --
> >>  include/linux/pagemap.h            |   18 ---
> >>  mm/balloon_compaction.c            |  214 ++++++++++++------------------------
> >>  mm/migrate.c                       |   27 +----
> >>  6 files changed, 130 insertions(+), 324 deletions(-)
> >>
> > Very nice clean-up, just as all other patches in this set.
> > Please, just consider amending the following changes to this patch of yours
> 
> Well. Probably it's better to hide __Set/Clear inside mm/balloon_compaction.c
> it very unlikely that they might  be used by somebody else.
> mm.h contains too many obscure static inlines and other barely used stuff.
>
Although I agree that very few codesites will actually resort to them,
I believe there's no argument to hide __Set/Clear if PageBalloon() itself is there.
Take a look into how many codesites __{Set,Clear}PageBuddy are being
called -- (as in their Balloon counterpart, just 1 codesite each).

For the sake of consistency and ease of maintainability, either leave all
BalloonPage() and friends at mm.h or move them all out, 
hiding them in balloon_compaction.h.

> And it's worth to rename balloon_compaction.c/h into just balloon.c or
> memory_balloon because
> it provides generic balloon wtihout compaction too. Any objections?
>
No objections here, I was actually thinking about renaming them too.

--
Rafael
 
> >
> > Rafael
> > ---
> >
> > diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
> > index dc7073b..569cf96 100644
> > --- a/include/linux/balloon_compaction.h
> > +++ b/include/linux/balloon_compaction.h
> > @@ -75,41 +75,6 @@ extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info);
> >  #ifdef CONFIG_BALLOON_COMPACTION
> >  extern bool balloon_page_isolate(struct page *page);
> >  extern void balloon_page_putback(struct page *page);
> > -
> > -/*
> > - * balloon_page_insert - insert a page into the balloon's page list and make
> > - *                      the page->mapping assignment accordingly.
> > - * @page    : page to be assigned as a 'balloon page'
> > - * @mapping : allocated special 'balloon_mapping'
> > - * @head    : balloon's device page list head
> > - *
> > - * Caller must ensure the page is locked and the spin_lock protecting balloon
> > - * pages list is held before inserting a page into the balloon device.
> > - */
> > -static inline void
> > -balloon_page_insert(struct balloon_dev_info *balloon, struct page *page)
> > -{
> > -       __SetPageBalloon(page);
> > -       set_page_private(page, (unsigned long)balloon);
> > -       list_add(&page->lru, &balloon->pages);
> > -}
> > -
> > -/*
> > - * balloon_page_delete - delete a page from balloon's page list and clear
> > - *                      the page->mapping assignement accordingly.
> > - * @page    : page to be released from balloon's page list
> > - *
> > - * Caller must ensure the page is locked and the spin_lock protecting balloon
> > - * pages list is held before deleting a page from the balloon device.
> > - */
> > -static inline void balloon_page_delete(struct page *page, bool isolated)
> > -{
> > -       __ClearPageBalloon(page);
> > -       set_page_private(page, 0);
> > -       if (!isolated)
> > -               list_del(&page->lru);
> > -}
> > -
> >  int balloon_page_migrate(new_page_t get_new_page, free_page_t put_new_page,
> >                 unsigned long private, struct page *page,
> >                 int force, enum migrate_mode mode);
> > @@ -130,31 +95,6 @@ static inline gfp_t balloon_mapping_gfp_mask(void)
> >
> >  #else /* !CONFIG_BALLOON_COMPACTION */
> >
> > -static inline void *balloon_mapping_alloc(void *balloon_device,
> > -                               const struct address_space_operations *a_ops)
> > -{
> > -       return ERR_PTR(-EOPNOTSUPP);
> > -}
> > -
> > -static inline void balloon_mapping_free(struct address_space *balloon_mapping)
> > -{
> > -       return;
> > -}
> > -
> > -static inline void
> > -balloon_page_insert(struct balloon_dev_info *balloon, struct page *page)
> > -{
> > -       __SetPageBalloon(page);
> > -       list_add(&page->lru, head);
> > -}
> > -
> > -static inline void balloon_page_delete(struct page *page, bool isolated)
> > -{
> > -       __ClearPageBalloon(page);
> > -       if (!isolated)
> > -               list_del(&page->lru);
> > -}
> > -
> >  static inline int balloon_page_migrate(new_page_t get_new_page,
> >                 free_page_t put_new_page, unsigned long private,
> >                 struct page *page, int force, enum migrate_mode mode)
> > @@ -176,6 +116,46 @@ static inline gfp_t balloon_mapping_gfp_mask(void)
> >  {
> >         return GFP_HIGHUSER;
> >  }
> > -
> >  #endif /* CONFIG_BALLOON_COMPACTION */
> > +
> > +/*
> > + * balloon_page_insert - insert a page into the balloon's page list and make
> > + *                      the page->mapping assignment accordingly.
> > + * @page    : page to be assigned as a 'balloon page'
> > + * @mapping : allocated special 'balloon_mapping'
> > + * @head    : balloon's device page list head
> > + *
> > + * Caller must ensure the page is locked and the spin_lock protecting balloon
> > + * pages list is held before inserting a page into the balloon device.
> > + */
> > +static inline void
> > +balloon_page_insert(struct balloon_dev_info *balloon, struct page *page)
> > +{
> > +#ifdef CONFIG_MEMORY_BALLOON
> > +       __SetPageBalloon(page);
> > +       set_page_private(page, (unsigned long)balloon);
> > +       list_add(&page->lru, &balloon->pages);
> > +       inc_zone_page_state(page, NR_BALLOON_PAGES);
> > +#endif
> > +}
> > +
> > +/*
> > + * balloon_page_delete - delete a page from balloon's page list and clear
> > + *                      the page->mapping assignement accordingly.
> > + * @page    : page to be released from balloon's page list
> > + *
> > + * Caller must ensure the page is locked and the spin_lock protecting balloon
> > + * pages list is held before deleting a page from the balloon device.
> > + */
> > +static inline void balloon_page_delete(struct page *page, bool isolated)
> > +{
> > +#ifdef CONFIG_MEMORY_BALLOON
> > +       __ClearPageBalloon(page);
> > +       set_page_private(page, 0);
> > +       if (!isolated)
> > +               list_del(&page->lru);
> > +       dec_zone_page_state(page, NR_BALLOON_PAGES);
> > +#endif
> > +}
> > +
> >  #endif /* _LINUX_BALLOON_COMPACTION_H */
> > --
> > 1.9.3
> >
> > --
> > 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>

  reply	other threads:[~2014-08-21 12:32 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20 15:04 [PATCH 1/7] mm/balloon_compaction: ignore anonymous pages Konstantin Khlebnikov
2014-08-20 15:04 ` Konstantin Khlebnikov
2014-08-20 15:04 ` [PATCH 2/7] mm/balloon_compaction: keep ballooned pages away from normal migration path Konstantin Khlebnikov
2014-08-20 15:04   ` Konstantin Khlebnikov
2014-08-20 23:33   ` Rafael Aquini
2014-08-20 23:33     ` Rafael Aquini
2014-08-20 15:04 ` [PATCH 3/7] mm/balloon_compaction: isolate balloon pages without lru_lock Konstantin Khlebnikov
2014-08-20 15:04   ` Konstantin Khlebnikov
2014-08-20 23:35   ` Rafael Aquini
2014-08-20 23:35     ` Rafael Aquini
2014-08-20 15:04 ` [PATCH 4/7] selftests/vm/transhuge-stress: stress test for memory compaction Konstantin Khlebnikov
2014-08-20 15:04   ` Konstantin Khlebnikov
2014-08-20 15:04 ` [PATCH 5/7] mm: introduce common page state for ballooned memory Konstantin Khlebnikov
2014-08-20 15:04   ` Konstantin Khlebnikov
2014-08-20 23:46   ` Rafael Aquini
2014-08-20 23:46     ` Rafael Aquini
2014-08-20 15:05 ` [PATCH 6/7] mm/balloon_compaction: use common page ballooning Konstantin Khlebnikov
2014-08-20 15:05   ` Konstantin Khlebnikov
2014-08-20 23:48   ` Rafael Aquini
2014-08-20 23:48     ` Rafael Aquini
2014-08-20 15:05 ` [PATCH 7/7] mm/balloon_compaction: general cleanup Konstantin Khlebnikov
2014-08-20 15:05   ` Konstantin Khlebnikov
     [not found]   ` <5ad4664811559496e563ead974f10e8ee6b4ed47.1408576903.git.aquini@redhat.com>
2014-08-20 23:58     ` Rafael Aquini
2014-08-20 23:58       ` Rafael Aquini
2014-08-21  7:30       ` Konstantin Khlebnikov
2014-08-21  7:30         ` Konstantin Khlebnikov
2014-08-21 12:31         ` Rafael Aquini [this message]
2014-08-21 12:31           ` Rafael Aquini
2014-08-29 21:05   ` Andrew Morton
2014-08-29 21:05     ` Andrew Morton
2014-08-29 21:09     ` Rafael Aquini
2014-08-29 21:09       ` Rafael Aquini
2014-08-29 21:26       ` Rafael Aquini
2014-08-29 21:26         ` Rafael Aquini
2014-08-29 21:38   ` Andrew Morton
2014-08-29 21:38     ` Andrew Morton
2014-08-30  6:44     ` Konstantin Khlebnikov
2014-08-30  6:44       ` Konstantin Khlebnikov
2014-08-30 16:36       ` [PATCH] mm: rename "migrate_page" to "generic_migrate_page" Konstantin Khlebnikov
2014-08-30 16:36         ` Konstantin Khlebnikov
2014-08-20 23:32 ` [PATCH 1/7] mm/balloon_compaction: ignore anonymous pages Rafael Aquini
2014-08-20 23:32   ` Rafael Aquini

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=20140821123157.GA19986@optiplex.redhat.com \
    --to=aquini@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=k.khlebnikov@samsung.com \
    --cc=koct9i@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ryabinin.a.a@gmail.com \
    --cc=sasha.levin@oracle.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.