[Devel] [RFC PATCH vz9 v2 07/11] ploop: convert wait_list and wb_batch_llist to use lockless lists

2024-10-14 Thread Alexander Atanasov
Convert to lockless lists - intermix with regular list due to that next pointer in both list_head and llist_head is the first field, and prev is not used. Do this so we can make babysteps forward. Signed-off-by: Alexander Atanasov --- drivers/md/dm-ploop-bat.c| 3 +-- drivers/md/dm-ploop-ma

[Devel] [RFC PATCH vz9 v2 10/11] ploop: convert the rest of the lists to use llist variant

2024-10-14 Thread Alexander Atanasov
convert the rest of the lists to use lockless list variant Signed-off-by: Alexander Atanasov --- drivers/md/dm-ploop-map.c| 119 ++- drivers/md/dm-ploop-target.c | 6 +- drivers/md/dm-ploop.h| 4 +- 3 files changed, 79 insertions(+), 50 deletions(-

[Devel] [RFC PATCH vz9 v2 11/11] ploop: combine processing of pios thru prepare list and remove fsync worker

2024-10-14 Thread Alexander Atanasov
Currently data pios and fluses are separated into different lists before handled to workqueue. This can lead to executing of flushes before relevant data pios and it is not possible to get that dependancy in the worker. So put both data and flush pios into prepare list. This way worker can get sing

[Devel] [RFC PATCH vz9 v2 03/11] ploop: fsync after all pios are sent

2024-10-14 Thread Alexander Atanasov
Currently there are two workers one to handle pios, one to handle flush (via vfs_fsync). This workers are created unbound which means they are run whenever there is a free CPU. When ploop sends pios (via ploop_dispatch_pios) it checks if there are data and if there are flush pios. If both are prese

[Devel] [RFC PATCH vz9 v2 04/11] ploop: move md status to use proper bitops

2024-10-14 Thread Alexander Atanasov
Fix direct bitops to use set_bit/clear_bit which are atomic - this is required since there are some places in code that do not use locking when operating on that bits. this is also a preparation to relax locking. https://virtuozzo.atlassian.net/browse/VSTOR-91820 Signed-off-by: Alexander Atanasov

[Devel] [RFC PATCH vz9 v2 02/11] ploop: Use READ_ONCE/WRITE_ONCE to access md page data

2024-10-14 Thread Alexander Atanasov
Prepare to reduce locking by using atomic 32 bit access to the fields. To ensure this we need to use the _ONCE macros. https://virtuozzo.atlassian.net/browse/VSTOR-91659 Signed-off-by: Alexander Atanasov --- drivers/md/dm-ploop-bat.c | 20 ++-- drivers/md/dm-ploop-cmd.c | 28

[Devel] [RFC PATCH vz9 v2 05/11] ploop: remove unneccessary lock

2024-10-14 Thread Alexander Atanasov
now proper bitops are used for status we do not need to lock. Signed-off-by: Alexander Atanasov --- drivers/md/dm-ploop-cmd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c index 8bbb1680c579..61daaf8415c9 100644 --- a/drivers/md/dm-plo

[Devel] [RFC PATCH vz9 v2 06/11] ploop: reduce the time lock is hold, taking it only to protect data

2024-10-14 Thread Alexander Atanasov
Currently lock is taken once for all pios submitted(code block), move it to protect only the list insertion (data). The goal is to reduce lock contention on the deferred lock as it is in the top of lock stats. Signed-off-by: Alexander Atanasov --- drivers/md/dm-ploop-map.c | 8 1 file c

[Devel] [RFC PATCH vz9 v2 08/11] ploop: convert enospc handling to use lockless lists

2024-10-14 Thread Alexander Atanasov
convert enospc handling to use lockless lists Signed-off-by: Alexander Atanasov --- drivers/md/dm-ploop-map.c| 23 --- drivers/md/dm-ploop-target.c | 3 ++- drivers/md/dm-ploop.h| 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/md/

[Devel] [RFC PATCH vz9 v2 09/11] ploop: convert suspended_pios list to use lockless list

2024-10-14 Thread Alexander Atanasov
convert suspended_pios list to use lockless list Signed-off-by: Alexander Atanasov --- drivers/md/dm-ploop-cmd.c| 13 +++-- drivers/md/dm-ploop-map.c| 2 +- drivers/md/dm-ploop-target.c | 2 +- drivers/md/dm-ploop.h| 2 +- 4 files changed, 14 insertions(+), 5 deletions

[Devel] [RFC PATCH vz9 v2 01/11] ploop: md_pages map all pages at creation time

2024-10-14 Thread Alexander Atanasov
md_page is always present in memory. In that case md_page->page could be always be mapped and we would not need to perform kmap_atomic/kunmap_atomic during each lookup https://virtuozzo.atlassian.net/browse/VSTOR-91659 Suggested-by: Denis V. Lunev Signed-off-by: Alexander Atanasov --- drivers/m