Commit 4289531
gpu/buddy: bail out of try_harder when alignment cannot be honoured
[ Upstream commit 56bc638 ]
The try_harder contiguous fallback could return a range whose start
offset did not match the caller's min_block_size. When a candidate's
start is misaligned, realign it: free the misaligned run and reallocate
exactly @SiZe at the next lower min_block_size boundary. This keeps the
returned size unchanged with no surplus to trim, and rejects the request
only when no aligned candidate fits.
v2: align misaligned candidates down to min_block_size instead of
bailing out, for both the RHS and LHS paths (Matthew).
Fixes: 0a1844b ("drm/buddy: Improve contiguous memory allocation")
Suggested-by: Christian König <christian.koenig@amd.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Timur Kristóf <timur.kristof@gmail.com>
Cc: stable@vger.kernel.org
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Tested-by: John Olender <john.olender@gmail.com>
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Link: https://patch.msgid.link/20260709131050.1022759-1-Arunpravin.PaneerSelvam@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 1c44c26 commit 4289531
1 file changed
Lines changed: 44 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
901 | 901 | | |
902 | 902 | | |
903 | 903 | | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
904 | 915 | | |
905 | 916 | | |
906 | 917 | | |
907 | 918 | | |
908 | 919 | | |
909 | | - | |
| 920 | + | |
910 | 921 | | |
911 | 922 | | |
912 | | - | |
913 | | - | |
914 | 923 | | |
915 | 924 | | |
916 | 925 | | |
917 | 926 | | |
918 | | - | |
919 | | - | |
| 927 | + | |
920 | 928 | | |
921 | 929 | | |
922 | 930 | | |
| |||
932 | 940 | | |
933 | 941 | | |
934 | 942 | | |
935 | | - | |
936 | 943 | | |
| 944 | + | |
| 945 | + | |
937 | 946 | | |
938 | 947 | | |
939 | | - | |
| 948 | + | |
940 | 949 | | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
941 | 967 | | |
942 | | - | |
943 | | - | |
944 | | - | |
| 968 | + | |
| 969 | + | |
945 | 970 | | |
946 | | - | |
947 | | - | |
948 | | - | |
949 | | - | |
950 | | - | |
951 | | - | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
952 | 978 | | |
953 | | - | |
| 979 | + | |
954 | 980 | | |
955 | 981 | | |
956 | 982 | | |
957 | | - | |
| 983 | + | |
958 | 984 | | |
959 | | - | |
960 | 985 | | |
961 | 986 | | |
962 | 987 | | |
| |||
0 commit comments