df Output Ordering

Sometimes questions come up that you know you should know the answer to but you just don’t. My recent one was “how does df choose the output order?” The man page doesn’t mention the logic behind it and a quick strace shows it pulls its data from /proc/mounts (which you’d expect) and returns the output in the same order. So logically the question becomes how does /proc/mounts order things?

It’s not exactly an important question but I can see how this ends - and it involves source code.