On Sun, Aug 27, 2023 at 10:57:59AM +0100, Lorenzo Stoakes wrote: > On Tue, Aug 22, 2023 at 01:54:59AM +0000, Joel Fernandes (Google) wrote: > > Move a block of memory within a memory range. Any alignment optimization > > on the source address may cause corruption. Verify using kselftest that > > it works. I have also verified with tracing that such optimization does > > not happen due to this check in can_align_down(): > > > > if (!for_stack && vma->vm_start <= addr_masked) > > return false; > > > > Signed-off-by: Joel Fernandes (Google) <joel@xxxxxxxxxxxxxxxxx> > > --- > > tools/testing/selftests/mm/mremap_test.c | 79 +++++++++++++++++++++++- > > 1 file changed, 78 insertions(+), 1 deletion(-) > > > > diff --git a/tools/testing/selftests/mm/mremap_test.c b/tools/testing/selftests/mm/mremap_test.c > > index d7366074e2a8..f45d1abedc9c 100644 > > --- a/tools/testing/selftests/mm/mremap_test.c > > +++ b/tools/testing/selftests/mm/mremap_test.c > > @@ -23,6 +23,7 @@ > > #define VALIDATION_NO_THRESHOLD 0 /* Verify the entire region */ > > > > #define MIN(X, Y) ((X) < (Y) ? (X) : (Y)) > > +#define SIZE_MB(m) ((size_t)m * (1024 * 1024)) > > Nit in this instance since you always just use an integer, but generally > for good practice's sake - shouldn't we place m in parens e.g. (size_t)(m) > to avoid broken macro expansion? Sure, I'll do that. Thanks. > I drew a little diagram for myself and was thereby convinced this was a good test, therefore, > > Reviewed-by: Lorenzo Stoakes <lstoakes@xxxxxxxxx> Thanks a lot! - Joel