[LU-14016] libcfs: use atomic64_t for libcfs_kmemory Created: 07/Oct/20 Updated: 29/Oct/20 Resolved: 29/Oct/20 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Lustre 2.14.0 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Amir Shehata (Inactive) | Assignee: | Amir Shehata (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||
| Severity: | 3 | ||||
| Rank (Obsolete): | 9223372036854775807 | ||||
| Description |
|
If LNet uses more than ~2.14 GB of memory, then lnet_memused will display negative numbers. |
| Comments |
| Comment by Gerrit Updater [ 07/Oct/20 ] |
|
Amir Shehata (ashehata@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/40168 |
| Comment by Andreas Dilger [ 07/Oct/20 ] |
|
It would probably be good (in a follow-on patch) to change libcfs_kmem (and obd_memory) to be struct percpu_counter instead of atomic64_t to avoid the overhead of atomic updates for every allocation, since we don't really depend on the current value of this variable for anything, only the eventual global consistency. That would mostly be a matter of changing libcfs_kmem_read() to use percpu_counter_sum() (it is only used at module startup/shutdown so accuracy is more important than performance), libcfs_kmem_inc/dec() to use percpu_counter_add_batch() (with a batch=1M or so, since we don't need frequent updates, only enough for fcb->count to be updated for lnet_memused to be relatively accurate), and adding percpu_counter_init(&libcfs_kmem) at the start of libcfs_init() and percpu_counter_destroy(&libcfs_kmem) after its last usage in libcfs_exit(). |
| Comment by Gerrit Updater [ 29/Oct/20 ] |
|
Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/40168/ |
| Comment by Peter Jones [ 29/Oct/20 ] |
|
Landed for 2.14 |