Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1702714 > unrolled thread
| Started by | Wei Wang <wei.w.wang@intel.com> |
|---|---|
| First post | 2017-08-03 08:50 +0200 |
| Last post | 2017-08-10 10:00 +0200 |
| Articles | 6 on this page of 26 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH v13 0/5] Virtio-balloon Enhancement Wei Wang <wei.w.wang@intel.com> - 2017-08-03 08:50 +0200
[PATCH v13 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG Wei Wang <wei.w.wang@intel.com> - 2017-08-03 09:00 +0200
Re: [PATCH v13 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG "Michael S. Tsirkin" <mst@redhat.com> - 2017-08-03 16:30 +0200
RE: [PATCH v13 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG "Wang, Wei W" <wei.w.wang@intel.com> - 2017-08-03 17:20 +0200
Re: [PATCH v13 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG "Michael S. Tsirkin" <mst@redhat.com> - 2017-08-03 18:00 +0200
[PATCH v13 4/5] mm: support reporting free page blocks Wei Wang <wei.w.wang@intel.com> - 2017-08-03 09:00 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks Michal Hocko <mhocko@kernel.org> - 2017-08-03 11:20 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks Wei Wang <wei.w.wang@intel.com> - 2017-08-03 12:40 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks Michal Hocko <mhocko@kernel.org> - 2017-08-03 12:50 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks Wei Wang <wei.w.wang@intel.com> - 2017-08-03 13:30 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks Michal Hocko <mhocko@kernel.org> - 2017-08-03 13:30 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks Wei Wang <wei.w.wang@intel.com> - 2017-08-03 14:10 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks Michal Hocko <mhocko@kernel.org> - 2017-08-03 14:50 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks Wei Wang <wei.w.wang@intel.com> - 2017-08-03 15:20 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks Michal Hocko <mhocko@kernel.org> - 2017-08-03 16:00 +0200
RE: [PATCH v13 4/5] mm: support reporting free page blocks "Wang, Wei W" <wei.w.wang@intel.com> - 2017-08-03 17:30 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks "Michael S. Tsirkin" <mst@redhat.com> - 2017-08-03 23:10 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks Michal Hocko <mhocko@kernel.org> - 2017-08-04 10:00 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks Wei Wang <wei.w.wang@intel.com> - 2017-08-04 10:20 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks Michal Hocko <mhocko@kernel.org> - 2017-08-04 10:30 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks Wei Wang <wei.w.wang@intel.com> - 2017-08-04 11:00 +0200
Re: [PATCH v13 4/5] mm: support reporting free page blocks Wei Wang <wei.w.wang@intel.com> - 2017-08-08 08:20 +0200
Re: [virtio-dev] Re: [PATCH v13 4/5] mm: support reporting free page blocks Wei Wang <wei.w.wang@intel.com> - 2017-08-08 08:40 +0200
Re: [virtio-dev] Re: [PATCH v13 4/5] mm: support reporting free page blocks Michal Hocko <mhocko@kernel.org> - 2017-08-10 09:10 +0200
Re: [virtio-dev] Re: [PATCH v13 4/5] mm: support reporting free page blocks Wei Wang <wei.w.wang@intel.com> - 2017-08-10 09:40 +0200
Re: [virtio-dev] Re: [PATCH v13 4/5] mm: support reporting free page blocks Michal Hocko <mhocko@kernel.org> - 2017-08-10 10:00 +0200
Page 2 of 2 — ← Prev page 1 [2]
| From | Wei Wang <wei.w.wang@intel.com> |
|---|---|
| Date | 2017-08-04 11:00 +0200 |
| Subject | Re: [PATCH v13 4/5] mm: support reporting free page blocks |
| Message-ID | <uaGCB-4L1-13@gated-at.bofh.it> |
| In reply to | #1703785 |
On 08/04/2017 04:24 PM, Michal Hocko wrote: > >> For our use case, the callback just puts the reported page >> block to the ring, then returns. If the ring is full as the host >> is busy, then I think it should skip this one, and just return. >> Because: >> A. This is an optimization feature, losing a couple of free >> pages to report isn't that important; >> B. In reality, I think it's uncommon to see this ring getting >> full (I didn't observe ring full in the tests), since the host >> (consumer) is notified to take out the page block right >> after it is added. > I thought you only updated a pre allocated bitmat... Anyway, I cannot > comment on this part much as I am not familiar with your usecase. > Actually the bitmap is in the hypervisor (host). The callback puts the (pfn,size) on a ring which is shared with the hypervisor, then the hypervisor takes that info from the ring and updates that bitmap. Best, Wei
[toc] | [prev] | [next] | [standalone]
| From | Wei Wang <wei.w.wang@intel.com> |
|---|---|
| Date | 2017-08-08 08:20 +0200 |
| Subject | Re: [PATCH v13 4/5] mm: support reporting free page blocks |
| Message-ID | <uc61X-3Rd-1@gated-at.bofh.it> |
| In reply to | #1702820 |
On 08/03/2017 05:11 PM, Michal Hocko wrote:
> On Thu 03-08-17 14:38:18, Wei Wang wrote:
> This is just too ugly and wrong actually. Never provide struct page
> pointers outside of the zone->lock. What I've had in mind was to simply
> walk free lists of the suitable order and call the callback for each one.
> Something as simple as
>
> for (i = 0; i < MAX_NR_ZONES; i++) {
> struct zone *zone = &pgdat->node_zones[i];
>
> if (!populated_zone(zone))
> continue;
Can we directly use for_each_populated_zone(zone) here?
> spin_lock_irqsave(&zone->lock, flags);
> for (order = min_order; order < MAX_ORDER; ++order) {
This appears to be covered by for_each_migratetype_order(order, mt) below.
> struct free_area *free_area = &zone->free_area[order];
> enum migratetype mt;
> struct page *page;
>
> if (!free_area->nr_pages)
> continue;
>
> for_each_migratetype_order(order, mt) {
> list_for_each_entry(page,
> &free_area->free_list[mt], lru) {
>
> pfn = page_to_pfn(page);
> visit(opaque2, prn, 1<<order);
> }
> }
> }
>
> spin_unlock_irqrestore(&zone->lock, flags);
> }
>
> [...]
>
What do you think if we further simply the above implementation like this:
for_each_populated_zone(zone) {
for_each_migratetype_order_decend(1, order, mt) {
spin_lock_irqsave(&zone->lock, flags);
list_for_each_entry(page,
&zone->free_area[order].free_list[mt], lru) {
pfn = page_to_pfn(page);
visit(opaque1, pfn, 1 << order);
}
spin_unlock_irqrestore(&zone->lock, flags);
}
}
Best,
Wei
[toc] | [prev] | [next] | [standalone]
| From | Wei Wang <wei.w.wang@intel.com> |
|---|---|
| Date | 2017-08-08 08:40 +0200 |
| Subject | Re: [virtio-dev] Re: [PATCH v13 4/5] mm: support reporting free page blocks |
| Message-ID | <uc6lj-3ZY-15@gated-at.bofh.it> |
| In reply to | #1706052 |
On 08/08/2017 02:12 PM, Wei Wang wrote:
> On 08/03/2017 05:11 PM, Michal Hocko wrote:
>> On Thu 03-08-17 14:38:18, Wei Wang wrote:
>> This is just too ugly and wrong actually. Never provide struct page
>> pointers outside of the zone->lock. What I've had in mind was to simply
>> walk free lists of the suitable order and call the callback for each
>> one.
>> Something as simple as
>>
>> for (i = 0; i < MAX_NR_ZONES; i++) {
>> struct zone *zone = &pgdat->node_zones[i];
>>
>> if (!populated_zone(zone))
>> continue;
>
> Can we directly use for_each_populated_zone(zone) here?
>
>
>> spin_lock_irqsave(&zone->lock, flags);
>> for (order = min_order; order < MAX_ORDER; ++order) {
>
>
> This appears to be covered by for_each_migratetype_order(order, mt)
> below.
>
>
>> struct free_area *free_area = &zone->free_area[order];
>> enum migratetype mt;
>> struct page *page;
>>
>> if (!free_area->nr_pages)
>> continue;
>>
>> for_each_migratetype_order(order, mt) {
>> list_for_each_entry(page,
>> &free_area->free_list[mt], lru) {
>>
>> pfn = page_to_pfn(page);
>> visit(opaque2, prn, 1<<order);
>> }
>> }
>> }
>>
>> spin_unlock_irqrestore(&zone->lock, flags);
>> }
>>
>> [...]
>>
>
> What do you think if we further simply the above implementation like
> this:
>
> for_each_populated_zone(zone) {
> for_each_migratetype_order_decend(1, order, mt) {
here it will be min_order (passed by the caller), instead of "1",
that is, for_each_migratetype_order_decend(min_order, order, mt)
> spin_lock_irqsave(&zone->lock, flags);
> list_for_each_entry(page,
> &zone->free_area[order].free_list[mt], lru) {
> pfn = page_to_pfn(page);
> visit(opaque1, pfn, 1 << order);
> }
> spin_unlock_irqrestore(&zone->lock, flags);
> }
> }
>
>
Best,
Wei
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-08-10 09:10 +0200 |
| Subject | Re: [virtio-dev] Re: [PATCH v13 4/5] mm: support reporting free page blocks |
| Message-ID | <ucPLs-2cT-17@gated-at.bofh.it> |
| In reply to | #1706066 |
On Tue 08-08-17 14:34:25, Wei Wang wrote:
> On 08/08/2017 02:12 PM, Wei Wang wrote:
> >On 08/03/2017 05:11 PM, Michal Hocko wrote:
> >>On Thu 03-08-17 14:38:18, Wei Wang wrote:
> >>This is just too ugly and wrong actually. Never provide struct page
> >>pointers outside of the zone->lock. What I've had in mind was to simply
> >>walk free lists of the suitable order and call the callback for each
> >>one.
> >>Something as simple as
> >>
> >> for (i = 0; i < MAX_NR_ZONES; i++) {
> >> struct zone *zone = &pgdat->node_zones[i];
> >>
> >> if (!populated_zone(zone))
> >> continue;
> >
> >Can we directly use for_each_populated_zone(zone) here?
yes, my example couldn't because I was still assuming per-node API
> >>spin_lock_irqsave(&zone->lock, flags);
> >> for (order = min_order; order < MAX_ORDER; ++order) {
> >
> >
> >This appears to be covered by for_each_migratetype_order(order, mt) below.
yes but
#define for_each_migratetype_order(order, type) \
for (order = 0; order < MAX_ORDER; order++) \
for (type = 0; type < MIGRATE_TYPES; type++)
so you would have to skip orders < min_order
--
Michal Hocko
SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Wei Wang <wei.w.wang@intel.com> |
|---|---|
| Date | 2017-08-10 09:40 +0200 |
| Subject | Re: [virtio-dev] Re: [PATCH v13 4/5] mm: support reporting free page blocks |
| Message-ID | <ucQeu-2mz-17@gated-at.bofh.it> |
| In reply to | #1708265 |
On 08/10/2017 03:05 PM, Michal Hocko wrote:
> On Tue 08-08-17 14:34:25, Wei Wang wrote:
>> On 08/08/2017 02:12 PM, Wei Wang wrote:
>>> On 08/03/2017 05:11 PM, Michal Hocko wrote:
>>>> On Thu 03-08-17 14:38:18, Wei Wang wrote:
>>>> This is just too ugly and wrong actually. Never provide struct page
>>>> pointers outside of the zone->lock. What I've had in mind was to simply
>>>> walk free lists of the suitable order and call the callback for each
>>>> one.
>>>> Something as simple as
>>>>
>>>> for (i = 0; i < MAX_NR_ZONES; i++) {
>>>> struct zone *zone = &pgdat->node_zones[i];
>>>>
>>>> if (!populated_zone(zone))
>>>> continue;
>>> Can we directly use for_each_populated_zone(zone) here?
> yes, my example couldn't because I was still assuming per-node API
>
>>>> spin_lock_irqsave(&zone->lock, flags);
>>>> for (order = min_order; order < MAX_ORDER; ++order) {
>>>
>>> This appears to be covered by for_each_migratetype_order(order, mt) below.
> yes but
> #define for_each_migratetype_order(order, type) \
> for (order = 0; order < MAX_ORDER; order++) \
> for (type = 0; type < MIGRATE_TYPES; type++)
>
> so you would have to skip orders < min_order
Yes, that's why we have a new macro
#define for_each_migratetype_order_decend(min_order, order, type) \
for (order = MAX_ORDER - 1; order < MAX_ORDER && order >= min_order; \
order--) \
for (type = 0; type < MIGRATE_TYPES; type++)
If you don't like the macro, we can also directly use it in the code.
I think it would be better to report the larger free page block first, since
the callback has an opportunity (though just a theoretical possibility,
good to
take that into consideration if possible) to skip reporting the given
free page
block to the hypervisor as the ring gets full. Losing the small block is
better
than losing the larger one, in terms of the optimization work.
Best,
Wei
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-08-10 10:00 +0200 |
| Subject | Re: [virtio-dev] Re: [PATCH v13 4/5] mm: support reporting free page blocks |
| Message-ID | <ucQxP-2tn-5@gated-at.bofh.it> |
| In reply to | #1708283 |
On Thu 10-08-17 15:38:34, Wei Wang wrote:
> On 08/10/2017 03:05 PM, Michal Hocko wrote:
> >On Tue 08-08-17 14:34:25, Wei Wang wrote:
> >>On 08/08/2017 02:12 PM, Wei Wang wrote:
> >>>On 08/03/2017 05:11 PM, Michal Hocko wrote:
> >>>>On Thu 03-08-17 14:38:18, Wei Wang wrote:
> >>>>This is just too ugly and wrong actually. Never provide struct page
> >>>>pointers outside of the zone->lock. What I've had in mind was to simply
> >>>>walk free lists of the suitable order and call the callback for each
> >>>>one.
> >>>>Something as simple as
> >>>>
> >>>> for (i = 0; i < MAX_NR_ZONES; i++) {
> >>>> struct zone *zone = &pgdat->node_zones[i];
> >>>>
> >>>> if (!populated_zone(zone))
> >>>> continue;
> >>>Can we directly use for_each_populated_zone(zone) here?
> >yes, my example couldn't because I was still assuming per-node API
> >
> >>>>spin_lock_irqsave(&zone->lock, flags);
> >>>> for (order = min_order; order < MAX_ORDER; ++order) {
> >>>
> >>>This appears to be covered by for_each_migratetype_order(order, mt) below.
> >yes but
> >#define for_each_migratetype_order(order, type) \
> > for (order = 0; order < MAX_ORDER; order++) \
> > for (type = 0; type < MIGRATE_TYPES; type++)
> >
> >so you would have to skip orders < min_order
>
> Yes, that's why we have a new macro
>
> #define for_each_migratetype_order_decend(min_order, order, type) \
> for (order = MAX_ORDER - 1; order < MAX_ORDER && order >= min_order; \
> order--) \
> for (type = 0; type < MIGRATE_TYPES; type++)
>
> If you don't like the macro, we can also directly use it in the code.
>
> I think it would be better to report the larger free page block first, since
> the callback has an opportunity (though just a theoretical possibility, good
> to
> take that into consideration if possible) to skip reporting the given free
> page
> block to the hypervisor as the ring gets full. Losing the small block is
> better
> than losing the larger one, in terms of the optimization work.
I see. But I think this is so specialized that opencoding the macro
would be easier to read.
--
Michal Hocko
SUSE Labs
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | linux.kernel
csiph-web