On Fri, Sep 12, 2025 at 5:36 PM Suren Baghdasaryan <surenb@xxxxxxxxxx> wrote: > > > > > Suren is > > > > fixing the condition of VM_BUG_ON_PAGE() in slab_obj_exts(). With this > > > > patch, I think, that condition will need to be changed again. > > > > > > That's orthogonal and I'm not convinced it's correct. > > > slab_obj_exts() is doing the right thing. afaict. > > > > Currently we have > > > > VM_BUG_ON_PAGE(obj_exts && !(obj_exts & MEMCG_DATA_OBJEXTS)) > > > > but it should be (before your patch) something like: > > > > VM_BUG_ON_PAGE(obj_exts && !(obj_exts & (MEMCG_DATA_OBJEXTS | OBJEXTS_ALLOC_FAIL))) > > > > After your patch, hmmm, the previous one would be right again and the > > newer one will be the same as the previous due to aliasing. This patch > > doesn't need to touch that VM_BUG. Older kernels will need to move to > > the second condition though. > > Correct. Currently slab_obj_exts() will issue a warning when (obj_exts > == OBJEXTS_ALLOC_FAIL), which is a perfectly valid state indicating > that previous allocation of the vector failed due to memory > exhaustion. Changing that warning to: > > VM_BUG_ON_PAGE(obj_exts && !(obj_exts & (MEMCG_DATA_OBJEXTS | > OBJEXTS_ALLOC_FAIL))) > > will correctly avoid this warning and after your change will still > work. (MEMCG_DATA_OBJEXTS | OBJEXTS_ALLOC_FAIL) when > (MEMCG_DATA_OBJEXTS == OBJEXTS_ALLOC_FAIL) is technically unnecessary > but is good for documenting the conditions we are checking. I see what you mean. I feel the comment in slab_obj_exts() that explains all that would be better long term than decipher from C code. Both are fine, I guess.