Scan from right to left to find the first element that is smaller than its right neighbor. Call this the pivot. Everything to the right of the pivot is in descending order.
Find the smallest element to the right of pivot that is larger than pivot. Swap them. Then reverse the suffix after the pivot position to get the smallest arrangement.
If no pivot exists (entire array is descending), just reverse the whole array to get the smallest permutation.