Page MenuHomeFreeBSD

vm_object_coalesce(): return swap reservation back if overcharged
ClosedPublic

Authored by kib on Mon, Dec 22, 12:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 30, 8:41 PM
Unknown Object (File)
Tue, Dec 30, 9:14 AM
Unknown Object (File)
Tue, Dec 30, 8:53 AM
Unknown Object (File)
Mon, Dec 29, 9:26 PM
Unknown Object (File)
Mon, Dec 29, 8:23 PM
Unknown Object (File)
Mon, Dec 29, 6:59 PM
Unknown Object (File)
Mon, Dec 29, 6:33 PM
Unknown Object (File)
Mon, Dec 29, 6:30 PM
Subscribers

Details

Summary
It is possible for both vm_map_insert() and vm_object_coalesce() to charge
both for the same region.  The issue is that vm_map_insert() must charge
in advance to ensure that the mapping would not exceed the swap limit,
but then the coalesce might decide to extend the object, and already
(partially) backs the mapped region.

Handle this by passing to vm_object_coalesce() exact information about
the charging mode of the extending range 'not charging', 'charged' using
flags instead of simple boolean.  In vm_object_coalesce(), detect
overcharge and undo it if needed.

Note that this relies on vm_object_coalesce() call being the last action
in vm_map_insert() before extending the previous map entry.

Reported by:    pho

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Mon, Dec 22, 12:51 PM

NB: this is still being tested by Peter, I decided to go ahead and publish the review as an early exposure

I ran the full set of stress2 tests, without seeing any issues.

Ping? This is a follow-up fix after D54263, and I want to commit them together.

In D54338#1243187, @kib wrote:

Ping? This is a follow-up fix after D54263, and I want to commit them together.

Sorry, I am catching up on reviews today.

Does the patch need to be rebased? I can't apply it to main, the last two hunks in vm_object.c don't apply.

In D54338#1243187, @kib wrote:

Ping? This is a follow-up fix after D54263, and I want to commit them together.

Sorry, I am catching up on reviews today.

Does the patch need to be rebased? I can't apply it to main, the last two hunks in vm_object.c don't apply.

It is on top of D54263

In D54338#1243198, @kib wrote:
In D54338#1243187, @kib wrote:

Ping? This is a follow-up fix after D54263, and I want to commit them together.

Sorry, I am catching up on reviews today.

Does the patch need to be rebased? I can't apply it to main, the last two hunks in vm_object.c don't apply.

It is on top of D54263

Yes, but an old version of D54263, so the patch still doesn't apply for me.

Re-upload the latest version

This revision is now accepted and ready to land.Tue, Dec 30, 1:02 AM