> On Mon, Apr 13, 2026 at 07:57:55PM +0800, Miaohe Lin wrote:
[...snip...]
> > -
> > +   case MADV_SOFT_DIRTY_SHMEM:
> >             /* The page content should remain unchanged. */
> >             ASSERT_TRUE(check_memory(vaddr, self->page_size));
> 
> Why we skip check_memory() for case MADV_SOFT_CLEAN_SHMEM?

Because we did not write 0xce to clean_shmem.
The difference between clean and dirty pagecache is whether we synced
the dirty pages to disk. However, the difference between clean and dirty
shmem is whether we initialized it with 0xce. Thus, we need to skip
check_memory(), which checking 0xce,  for clean_shmem.

> > +   case MADV_HARD_CLEAN_SHMEM:
> > +   case MADV_SOFT_CLEAN_SHMEM:
> > +           /* It is not expected to receive a SIGBUS signal. */
> > +           ASSERT_EQ(setjmp, 0);
[...snip...]
> > +   if (variant->type == MADV_HARD) {
> > +           check(_metadata, self, addr, MADV_HARD_DIRTY_SHMEM, ret);
> > +           ret = sigsetjmp(signal_jmp_buf, 1);
> > +           if (ret == 0)
> > +                   FORCE_READ(*addr);
> > +           check(_metadata, self, addr, READ_ERROR, ret);
> > +   } else {
> 
> Should we always add a FORCE_READ() just after variant->inject to verify the 
> accessibility
> to the addr for soft-offline case ?
> 
> Thanks.

In dirty_shmem, check() already verifies accessibility to the address
through memcmp(). Thus, we only need FORCE_READ() in clean_shmem. Will
add this in the next version. Thanks !

Lisa

> > +           check(_metadata, self, addr, MADV_SOFT_DIRTY_SHMEM, ret);> +    
> > }
[...snip...]


Reply via email to