From: Alexander Duyck <alexander.duyck@gmail.com>
To: Nitesh Narayan Lal <nitesh@redhat.com>
Cc: kvm list <kvm@vger.kernel.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
David Hildenbrand <david@redhat.com>,
Dave Hansen <dave.hansen@intel.com>,
LKML <linux-kernel@vger.kernel.org>,
Matthew Wilcox <willy@infradead.org>,
Michal Hocko <mhocko@kernel.org>, linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
virtio-dev@lists.oasis-open.org,
Oscar Salvador <osalvador@suse.de>,
Yang Zhang <yang.zhang.wz@gmail.com>,
Pankaj Gupta <pagupta@redhat.com>,
Rik van Riel <riel@surriel.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
lcapitulino@redhat.com, "Wang, Wei W" <wei.w.wang@intel.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Dan Williams <dan.j.williams@intel.com>,
Alexander Duyck <alexander.h.duyck@linux.intel.com>
Subject: Re: [virtio-dev] [PATCH v6 4/6] mm: Introduce Reported pages
Date: Thu, 22 Aug 2019 09:24:37 -0700 [thread overview]
Message-ID: <CAKgT0UeFyxH9pEsQ+CcZo3c4-GZdqsw6ucPG2KOkefvDvFF94g@mail.gmail.com> (raw)
In-Reply-To: <91355107-ed73-fce5-7051-3a746b526163@redhat.com>
On Thu, Aug 22, 2019 at 9:19 AM Nitesh Narayan Lal <nitesh@redhat.com> wrote:
>
>
> On 8/21/19 10:59 AM, Alexander Duyck wrote:
> > From: Alexander Duyck <alexander.h.duyck@linux.intel.com>
> >
> > In order to pave the way for free page reporting in virtualized
> > environments we will need a way to get pages out of the free lists and
> > identify those pages after they have been returned. To accomplish this,
> > this patch adds the concept of a Reported Buddy, which is essentially
> > meant to just be the Uptodate flag used in conjunction with the Buddy
> > page type.
> >
> > It adds a set of pointers we shall call "boundary" which represents the
> > upper boundary between the unreported and reported pages. The general idea
> > is that in order for a page to cross from one side of the boundary to the
> > other it will need to go through the reporting process. Ultimately a
> > free_list has been fully processed when the boundary has been moved from
> > the tail all they way up to occupying the first entry in the list.
> >
> > Doing this we should be able to make certain that we keep the reported
> > pages as one contiguous block in each free list. This will allow us to
> > efficiently manipulate the free lists whenever we need to go in and start
> > sending reports to the hypervisor that there are new pages that have been
> > freed and are no longer in use.
> >
> > An added advantage to this approach is that we should be reducing the
> > overall memory footprint of the guest as it will be more likely to recycle
> > warm pages versus trying to allocate the reported pages that were likely
> > evicted from the guest memory.
> >
> > Since we will only be reporting one zone at a time we keep the boundary
> > limited to being defined for just the zone we are currently reporting pages
> > from. Doing this we can keep the number of additional pointers needed quite
> > small. To flag that the boundaries are in place we use a single bit
> > in the zone to indicate that reporting and the boundaries are active.
> >
> > The determination of when to start reporting is based on the tracking of
> > the number of free pages in a given area versus the number of reported
> > pages in that area. We keep track of the number of reported pages per
> > free_area in a separate zone specific area. We do this to avoid modifying
> > the free_area structure as this can lead to false sharing for the highest
> > order with the zone lock which leads to a noticeable performance
> > degradation.
> [...]
> > +
> > +/* request page reporting on this zone */
> > +void __page_reporting_request(struct zone *zone)
> > +{
> > + struct page_reporting_dev_info *phdev;
> > +
> > + rcu_read_lock();
> > +
> > + /*
> > + * We use RCU to protect the ph_dev_info pointer. In almost all
> > + * cases this should be present, however in the unlikely case of
> > + * a shutdown this will be NULL and we should exit.
> > + */
> > + phdev = rcu_dereference(ph_dev_info);
> > + if (unlikely(!phdev))
> > + return;
> > +
>
> Just a minor comment here.
> Although this is unlikely to trigger still I think you should release the
> rcu_read_lock before returning.
Thanks for catching that. I will have that fixed for next version.
- Alex
next prev parent reply other threads:[~2019-08-22 16:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-21 14:59 [PATCH v6 0/6] mm / virtio: Provide support for unused page reporting Alexander Duyck
2019-08-21 14:59 ` [PATCH v6 1/6] mm: Adjust shuffle code to allow for future coalescing Alexander Duyck
2019-08-21 14:59 ` [PATCH v6 2/6] mm: Move set/get_pcppage_migratetype to mmzone.h Alexander Duyck
2019-08-21 14:59 ` [PATCH v6 3/6] mm: Use zone and order instead of free area in free_list manipulators Alexander Duyck
2019-08-21 14:59 ` [PATCH v6 4/6] mm: Introduce Reported pages Alexander Duyck
2019-08-22 16:18 ` [virtio-dev] " Nitesh Narayan Lal
2019-08-22 16:24 ` Alexander Duyck [this message]
2019-08-21 14:59 ` [PATCH v6 5/6] virtio-balloon: Pull page poisoning config out of free page hinting Alexander Duyck
2019-08-21 15:00 ` [PATCH v6 6/6] virtio-balloon: Add support for providing unused page reports to host Alexander Duyck
2019-08-21 15:00 ` [PATCH v6 QEMU 1/3] virtio-ballon: Implement support for page poison tracking feature Alexander Duyck
2019-08-21 15:00 ` [PATCH v6 QEMU 2/3] virtio-balloon: Add bit to notify guest of unused page reporting Alexander Duyck
2019-08-21 15:00 ` [PATCH v6 QEMU 3/3] virtio-balloon: Provide a interface for " Alexander Duyck
2019-08-22 10:43 ` [PATCH v6 0/6] mm / virtio: Provide support " Pankaj Gupta
2019-08-22 15:32 ` Alexander Duyck
2019-08-23 5:16 ` Pankaj Gupta
2019-08-23 15:02 ` Alexander Duyck
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=CAKgT0UeFyxH9pEsQ+CcZo3c4-GZdqsw6ucPG2KOkefvDvFF94g@mail.gmail.com \
--to=alexander.duyck@gmail.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.h.duyck@linux.intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@intel.com \
--cc=david@redhat.com \
--cc=konrad.wilk@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=lcapitulino@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mst@redhat.com \
--cc=nitesh@redhat.com \
--cc=osalvador@suse.de \
--cc=pagupta@redhat.com \
--cc=pbonzini@redhat.com \
--cc=riel@surriel.com \
--cc=virtio-dev@lists.oasis-open.org \
--cc=wei.w.wang@intel.com \
--cc=willy@infradead.org \
--cc=yang.zhang.wz@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).