Home
last modified time | relevance | path

Searched hist:"7 f64b301b1e78fb5a50c44a0cb2bb94a91e31d00" (Results 1 – 3 of 3) sorted by relevance

/haiku/headers/private/kernel/
H A Dport.h7f64b301b1e78fb5a50c44a0cb2bb94a91e31d00 Sat Oct 26 14:10:03 UTC 2013 Julian Harnath <julian.harnath@rwth-aachen.de> Reduce lock contention in kernel port subsystem.

* Replace ports list mutex with R/W-lock.

* Move team port list protection to separate array of mutexes.
Relieve contention on sPortsLock by removing Team::port_list from its
protected items. With this, set_port_owner() only needs to acquire the
sPortsLock for reading.

* Add another hash table holding the ports by name. Used by find_port()
so it doesn't have to iterate over the list anymore.

* Use slab-based memory allocator for port messages. sPortQuotaLock was
acquired on every message send or receive and was thus another point
of contention. The lock is not necessary anymore.

* Lock for port hashes and Port::lock are no longer locked in a nested
fashion to reduce chances of blocking other threads.

* Make operations concurrency-safe by adding an atomically accessed
Port::state which provides linearization points to port creation and
deletion. Both operations are now divided into logical and physical
parts, the logical part just updating the state and the physical part
adding/remove it to/from the port hash and team port list.

* set_port_owner() is the only remaining function which still locks
Port::lock and one or two of sTeamListLock[] in a nested fashion.
Since it needs to move the port from one team list to another and
change Port::owner, there's no way around.

* Ports are now reference counted to make accesses to already-deleted
ports safe.

* Should fix #8007.
/haiku/src/system/kernel/
H A Dport.cpp072b9ed0ac55f928af26dcebabb3397b17c96617 Sat Nov 23 20:13:24 UTC 2019 Augustin Cavalier <waddlesplash@gmail.com> kernel/port: Properly release the first reference to the Port object.

Creating a BReferenceable sets its reference count to 1.
create_port() was then acquiring 2 references for the two lists
it inserts the port object into, and subsequently delete_port()
releases those.

But that "reference 0" never was released anywhere, and so
despite being removed from hashes, etc. port objects were
just leaked, along with whatever messages remained in their
queue, never to be freed. This of course can add up pretty
quickly in systems that created and deleted ports frequently,
for instance, in long-running media playback, opening/closing
applications, etc.

As far as I can tell, this bug was introduced in the fix to
#8007 (7f64b301b1e78fb5a50c44a0cb2bb94a91e31d00), which introduced
the ref-counting system to the port heap, so it has been with us
since 2013 (!).

Fixes #15489, and probably some of the other "media playback
memory leak" tickets.
7f64b301b1e78fb5a50c44a0cb2bb94a91e31d00 Sat Oct 26 14:10:03 UTC 2013 Julian Harnath <julian.harnath@rwth-aachen.de> Reduce lock contention in kernel port subsystem.

* Replace ports list mutex with R/W-lock.

* Move team port list protection to separate array of mutexes.
Relieve contention on sPortsLock by removing Team::port_list from its
protected items. With this, set_port_owner() only needs to acquire the
sPortsLock for reading.

* Add another hash table holding the ports by name. Used by find_port()
so it doesn't have to iterate over the list anymore.

* Use slab-based memory allocator for port messages. sPortQuotaLock was
acquired on every message send or receive and was thus another point
of contention. The lock is not necessary anymore.

* Lock for port hashes and Port::lock are no longer locked in a nested
fashion to reduce chances of blocking other threads.

* Make operations concurrency-safe by adding an atomically accessed
Port::state which provides linearization points to port creation and
deletion. Both operations are now divided into logical and physical
parts, the logical part just updating the state and the physical part
adding/remove it to/from the port hash and team port list.

* set_port_owner() is the only remaining function which still locks
Port::lock and one or two of sTeamListLock[] in a nested fashion.
Since it needs to move the port from one team list to another and
change Port::owner, there's no way around.

* Ports are now reference counted to make accesses to already-deleted
ports safe.

* Should fix #8007.
H A Dteam.cpp7f64b301b1e78fb5a50c44a0cb2bb94a91e31d00 Sat Oct 26 14:10:03 UTC 2013 Julian Harnath <julian.harnath@rwth-aachen.de> Reduce lock contention in kernel port subsystem.

* Replace ports list mutex with R/W-lock.

* Move team port list protection to separate array of mutexes.
Relieve contention on sPortsLock by removing Team::port_list from its
protected items. With this, set_port_owner() only needs to acquire the
sPortsLock for reading.

* Add another hash table holding the ports by name. Used by find_port()
so it doesn't have to iterate over the list anymore.

* Use slab-based memory allocator for port messages. sPortQuotaLock was
acquired on every message send or receive and was thus another point
of contention. The lock is not necessary anymore.

* Lock for port hashes and Port::lock are no longer locked in a nested
fashion to reduce chances of blocking other threads.

* Make operations concurrency-safe by adding an atomically accessed
Port::state which provides linearization points to port creation and
deletion. Both operations are now divided into logical and physical
parts, the logical part just updating the state and the physical part
adding/remove it to/from the port hash and team port list.

* set_port_owner() is the only remaining function which still locks
Port::lock and one or two of sTeamListLock[] in a nested fashion.
Since it needs to move the port from one team list to another and
change Port::owner, there's no way around.

* Ports are now reference counted to make accesses to already-deleted
ports safe.

* Should fix #8007.