Commit 2299cee
ublk: use copy_{to,from}_iter() for user copy
ublk_copy_user_pages()/ublk_copy_io_pages() currently uses
iov_iter_get_pages2() to extract the pages from the iov_iter and
memcpy()s between the bvec_iter and the iov_iter's pages one at a time.
Switch to using copy_to_iter()/copy_from_iter() instead. This avoids the
user page reference count increments and decrements and needing to split
the memcpy() at user page boundaries. It also simplifies the code
considerably.
Ming reports a 40% throughput improvement when issuing I/O to the
selftests null ublk server with zero-copy disabled.
Signed-off-by: Caleb Sander Mateos <[email protected]>
Reviewed-by: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>1 parent 15638d5 commit 2299cee
1 file changed
Lines changed: 14 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
913 | 913 | | |
914 | 914 | | |
915 | 915 | | |
916 | | - | |
917 | | - | |
918 | 916 | | |
919 | | - | |
920 | 917 | | |
921 | 918 | | |
922 | 919 | | |
923 | 920 | | |
924 | | - | |
925 | | - | |
926 | | - | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
927 | 924 | | |
928 | | - | |
929 | | - | |
| 925 | + | |
930 | 926 | | |
931 | | - | |
| 927 | + | |
932 | 928 | | |
933 | | - | |
934 | | - | |
935 | 929 | | |
936 | | - | |
| 930 | + | |
937 | 931 | | |
938 | 932 | | |
939 | | - | |
| 933 | + | |
940 | 934 | | |
941 | | - | |
| 935 | + | |
942 | 936 | | |
943 | | - | |
944 | 937 | | |
945 | 938 | | |
946 | | - | |
947 | | - | |
948 | | - | |
949 | | - | |
950 | | - | |
951 | | - | |
952 | | - | |
953 | | - | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
954 | 942 | | |
955 | 943 | | |
956 | | - | |
| 944 | + | |
957 | 945 | | |
958 | 946 | | |
959 | 947 | | |
960 | 948 | | |
961 | 949 | | |
962 | 950 | | |
963 | 951 | | |
| 952 | + | |
964 | 953 | | |
965 | 954 | | |
966 | 955 | | |
| |||
988 | 977 | | |
989 | 978 | | |
990 | 979 | | |
991 | | - | |
992 | 980 | | |
993 | 981 | | |
994 | 982 | | |
995 | 983 | | |
996 | | - | |
997 | | - | |
998 | | - | |
999 | | - | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
1003 | | - | |
1004 | | - | |
1005 | | - | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | | - | |
1010 | | - | |
1011 | | - | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
1017 | | - | |
1018 | | - | |
| 984 | + | |
1019 | 985 | | |
1020 | 986 | | |
1021 | 987 | | |
| |||
0 commit comments