History log of /freebsd-10-stable/sys/vm/uma_core.c
Revision Date Author Comments
# 320440 28-Jun-2017 alc

MFC r281771
Eliminate an unused variable.


# 318169 11-May-2017 jhb

MFC 316493: Assert that the align parameter to uma_zcreate() is valid.


# 316839 14-Apr-2017 avg

MFC r315078: uma: fix pages <-> items conversions at several places


# 316838 14-Apr-2017 avg

MFC r286583: Avoid sign extension of value passed to kva_alloc from uma_zone_reserve_kva

On behalf of: zbb


# 316835 14-Apr-2017 avg

MFC r315077: uma: eliminate uk_slabsize field


# 314667 04-Mar-2017 avg

MFC r283291: don't use CALLOUT_MPSAFE with callout_init()

The main purpose of this MFC is to reduce conflicts for other merges.
Parts of the original change have already "trickled down" via individual MFCs.


# 314664 04-Mar-2017 avg

MFC r314272: call vm_lowmem hook in uma_reclaim_worker


# 304094 14-Aug-2016 markj

MFC r303059
Release the second critical section in uma_zfree_arg() slightly earlier.


# 287945 17-Sep-2015 rstone

MFC r280957

Fix integer truncation bug in malloc(9)

A couple of internal functions used by malloc(9) and uma truncated
a size_t down to an int. This could cause any number of issues
(e.g. indefinite sleeps, memory corruption) if any kernel
subsystem tried to allocate 2GB or more through malloc. zfs would
attempt such an allocation when run on a system with 2TB or more
of RAM.


# 283310 23-May-2015 kib

MFC r282690:
Call uma_reclaim() from the additional pagedaemon thread to reclaim kmem
arena address space.


# 281458 12-Apr-2015 dchagin

MFC r281113:
Fix wrong kassert msg in uma.

PR: 199172


# 275754 14-Dec-2014 kib

MFC r275347:
Provide mutual exclusion between zone allocation/destruction and
uma_reclaim().


# 273451 22-Oct-2014 bryanv

MFC r272573:

Change the UMA mutex into a rwlock

Acquire the lock in read mode when just needed to ensure the stability
of the keg list. The UMA lock may be held for a long time (relatively
speaking) in uma_reclaim() on machines with lots of zones/kegs. If the
uma_timeout() would fire during that period, subsequent callouts on that
CPU may be significantly delayed.


# 272722 08-Oct-2014 bryanv

MFC 272550:

Remove stray uma_mtx lock/unlock in zone_drain_wait()

Callers of zone_drain_wait(M_WAITOK) do not need to hold (and were not)
the uma_mtx, but we would attempt to unlock and relock the mutex if we
had to sleep because the zone was already draining. The M_NOWAIT callers
may hold the uma_mtx, but we do not sleep in that case.


# 267751 22-Jun-2014 mav

MFC r267391:
Introduce new "256 Bucket" zone to split requests and reduce congestion
on "128 Bucket" zone lock.


# 267750 22-Jun-2014 mav

MFC r267387:
Allocating new bucket for bucket zone, never take it from the zone itself,
since it will almost certanly fail. Take next bigger zone instead.

This situation should not happen with original bucket zones configuration:
"32 Bucket" zone uses "64 Bucket" and vice versa. But if "64 Bucket" zone
lock is congested, zone may grow its bucket size and start biting itself.


# 262739 04-Mar-2014 glebius

Merge r261722, r261723, r261724, r261725 from head:
several minor improvements for UMA_ZPCPU_ZONE zones.


# 262737 04-Mar-2014 glebius

Merge 261593 from head:
Provide macros that allow easily export uma(9) zone limits and
current usage via sysctl(9).


# 262127 17-Feb-2014 dim

MFC r261896:

After r251709, avoid a clang 3.4 warning about an unused static const
variable (uma_max_ipers), when asserts are disabled.

Reviewed by: glebius


# 260306 04-Jan-2014 mav

MFC r258716:
- Add bucket size column to `show uma` DDB command.
- Add `show umacache` command to show alike stats for cache-only UMA zones.


# 260305 04-Jan-2014 mav

MFC r258693:
Make UMA to not blindly force offpage slab header allocation for large
(> PAGE_SIZE) zones. If zone is not multiple to PAGE_SIZE, there may
be enough space for the header at the last page, so we may avoid extra
header memory allocation and hash table update/lookup.

ZFS creates bunch of odd-sized UMA zones (5120, 6144, 7168, 10240, 14336).
This change gives good use to at least some of otherwise lost memory there.


# 260304 04-Jan-2014 mav

MFC r258691:
Don't count bucket allocation failures for UMA zones as their own failures.
There are good reasons for this to happen, such as recursion prevention, etc.
and they are not fatal since buckets are just an optimization mechanism.
Real bucket allocation failures are any way counted by the bucket zones
themselves, and we don't need double accounting there.


# 260303 04-Jan-2014 mav

MFC r258340, r258497:
Implement mechanism to safely but slowly purge UMA per-CPU caches.

This is a last resort for very low memory condition in case other measures
to free memory were ineffective. Sequentially cycle through all CPUs and
extract per-CPU cache buckets into zone cache from where they can be freed.


# 260302 04-Jan-2014 mav

MFC r258338:
Grow UMA zone bucket size also on lock congestion during item free.

Lock congestion is the same, whether it happens on alloc or free, so
handle it equally. Now that we have back pressure, there is no problem
to grow buckets a bit faster. Any way growth is much slower then in 9.x.


# 260301 04-Jan-2014 mav

MFC r258337:
Add two new UMA bucket zones to store 3 and 9 items per bucket.

These new buckets make bucket size self-tuning more soft and precise.
Without them there are buckets for 1, 5, 13, 29, ... items. While at
bigger sizes difference about 2x is fine, at smallest ones it is 5x and
2.6x respectively. New buckets make that line look like 1, 3, 5, 9, 13,
29, reducing jumps between steps, making algorithm work softer, allocating
and freeing memory in better fitting chunks. Otherwise there is quite a
big gap between allocating 128K and 5x128K of RAM at once.


# 260300 04-Jan-2014 mav

MFC r258336:
Implement soft pressure on UMA cache bucket sizes.

Every time system detects low memory condition decrease bucket sizes for
each zone by one item. As result, higher memory pressure will push to
smaller bucket sizes and so smaller per-CPU caches and so more efficient
memory use.

Before this change there was no force to oppose buckets growth as result
of practically inevitable zone lock conflicts, and after some run time
per-CPU caches could consume enough RAM to kill the system.


# 260280 04-Jan-2014 glebius

Merge r258690 by mav from head:
Fix bug introduced at r252226, when udata argument passed to bucket_alloc()
was used without making sure first that it was really passed for us.

On some of my systems this bug made user argument passed by ZFS code to
uma_zalloc_arg() unexpectedly block UMA per-CPU caches for those zones.


# 258911 04-Dec-2013 rodrigc

MFC r258737

In keg_dtor(), print out the keg name in the "Freed UMA keg was not empty"
message printed to the console. This makes it easier to track down
the source of certain memory leaks.

Suggested by: adrian
Approved by: re (gjb)


# 287945 17-Sep-2015 rstone

MFC r280957

Fix integer truncation bug in malloc(9)

A couple of internal functions used by malloc(9) and uma truncated
a size_t down to an int. This could cause any number of issues
(e.g. indefinite sleeps, memory corruption) if any kernel
subsystem tried to allocate 2GB or more through malloc. zfs would
attempt such an allocation when run on a system with 2TB or more
of RAM.


# 283310 23-May-2015 kib

MFC r282690:
Call uma_reclaim() from the additional pagedaemon thread to reclaim kmem
arena address space.


# 281458 12-Apr-2015 dchagin

MFC r281113:
Fix wrong kassert msg in uma.

PR: 199172


# 275754 14-Dec-2014 kib

MFC r275347:
Provide mutual exclusion between zone allocation/destruction and
uma_reclaim().


# 273451 22-Oct-2014 bryanv

MFC r272573:

Change the UMA mutex into a rwlock

Acquire the lock in read mode when just needed to ensure the stability
of the keg list. The UMA lock may be held for a long time (relatively
speaking) in uma_reclaim() on machines with lots of zones/kegs. If the
uma_timeout() would fire during that period, subsequent callouts on that
CPU may be significantly delayed.


# 272722 08-Oct-2014 bryanv

MFC 272550:

Remove stray uma_mtx lock/unlock in zone_drain_wait()

Callers of zone_drain_wait(M_WAITOK) do not need to hold (and were not)
the uma_mtx, but we would attempt to unlock and relock the mutex if we
had to sleep because the zone was already draining. The M_NOWAIT callers
may hold the uma_mtx, but we do not sleep in that case.


# 267751 22-Jun-2014 mav

MFC r267391:
Introduce new "256 Bucket" zone to split requests and reduce congestion
on "128 Bucket" zone lock.


# 267750 22-Jun-2014 mav

MFC r267387:
Allocating new bucket for bucket zone, never take it from the zone itself,
since it will almost certanly fail. Take next bigger zone instead.

This situation should not happen with original bucket zones configuration:
"32 Bucket" zone uses "64 Bucket" and vice versa. But if "64 Bucket" zone
lock is congested, zone may grow its bucket size and start biting itself.


# 262739 04-Mar-2014 glebius

Merge r261722, r261723, r261724, r261725 from head:
several minor improvements for UMA_ZPCPU_ZONE zones.


# 262737 04-Mar-2014 glebius

Merge 261593 from head:
Provide macros that allow easily export uma(9) zone limits and
current usage via sysctl(9).


# 262127 17-Feb-2014 dim

MFC r261896:

After r251709, avoid a clang 3.4 warning about an unused static const
variable (uma_max_ipers), when asserts are disabled.

Reviewed by: glebius


# 260306 04-Jan-2014 mav

MFC r258716:
- Add bucket size column to `show uma` DDB command.
- Add `show umacache` command to show alike stats for cache-only UMA zones.


# 260305 04-Jan-2014 mav

MFC r258693:
Make UMA to not blindly force offpage slab header allocation for large
(> PAGE_SIZE) zones. If zone is not multiple to PAGE_SIZE, there may
be enough space for the header at the last page, so we may avoid extra
header memory allocation and hash table update/lookup.

ZFS creates bunch of odd-sized UMA zones (5120, 6144, 7168, 10240, 14336).
This change gives good use to at least some of otherwise lost memory there.


# 260304 04-Jan-2014 mav

MFC r258691:
Don't count bucket allocation failures for UMA zones as their own failures.
There are good reasons for this to happen, such as recursion prevention, etc.
and they are not fatal since buckets are just an optimization mechanism.
Real bucket allocation failures are any way counted by the bucket zones
themselves, and we don't need double accounting there.


# 260303 04-Jan-2014 mav

MFC r258340, r258497:
Implement mechanism to safely but slowly purge UMA per-CPU caches.

This is a last resort for very low memory condition in case other measures
to free memory were ineffective. Sequentially cycle through all CPUs and
extract per-CPU cache buckets into zone cache from where they can be freed.


# 260302 04-Jan-2014 mav

MFC r258338:
Grow UMA zone bucket size also on lock congestion during item free.

Lock congestion is the same, whether it happens on alloc or free, so
handle it equally. Now that we have back pressure, there is no problem
to grow buckets a bit faster. Any way growth is much slower then in 9.x.


# 260301 04-Jan-2014 mav

MFC r258337:
Add two new UMA bucket zones to store 3 and 9 items per bucket.

These new buckets make bucket size self-tuning more soft and precise.
Without them there are buckets for 1, 5, 13, 29, ... items. While at
bigger sizes difference about 2x is fine, at smallest ones it is 5x and
2.6x respectively. New buckets make that line look like 1, 3, 5, 9, 13,
29, reducing jumps between steps, making algorithm work softer, allocating
and freeing memory in better fitting chunks. Otherwise there is quite a
big gap between allocating 128K and 5x128K of RAM at once.


# 260300 04-Jan-2014 mav

MFC r258336:
Implement soft pressure on UMA cache bucket sizes.

Every time system detects low memory condition decrease bucket sizes for
each zone by one item. As result, higher memory pressure will push to
smaller bucket sizes and so smaller per-CPU caches and so more efficient
memory use.

Before this change there was no force to oppose buckets growth as result
of practically inevitable zone lock conflicts, and after some run time
per-CPU caches could consume enough RAM to kill the system.


# 260280 04-Jan-2014 glebius

Merge r258690 by mav from head:
Fix bug introduced at r252226, when udata argument passed to bucket_alloc()
was used without making sure first that it was really passed for us.

On some of my systems this bug made user argument passed by ZFS code to
uma_zalloc_arg() unexpectedly block UMA per-CPU caches for those zones.


# 258911 04-Dec-2013 rodrigc

MFC r258737

In keg_dtor(), print out the keg name in the "Freed UMA keg was not empty"
message printed to the console. This makes it easier to track down
the source of certain memory leaks.

Suggested by: adrian
Approved by: re (gjb)