Tony suggested a simplification to my original post on lkml, the result is this patch.