On Wed, Mar 3, 2021 at 6:02 AM Michal Hocko <mhocko@xxxxxxxx> wrote: > [...] > > > > + BUG_ON(vm->nr_pages != THREAD_SIZE / PAGE_SIZE); > > > > > > I do not think we need this BUG_ON. What kind of purpose does it serve? > > > > vm->nr_pages should be always equal to THREAD_SIZE / PAGE_SIZE > > if the system is not corrupted. > > BUG_ON is not an annotation for "this shouldn't happen". Even if the > system was corrupted and nr_pages wouldn't match then this is not a > reason to crash the kernel right away. > > In general there should be a very _strong_ reason to add a BUG_ON. > I agree with Michal. We should remove this BUG_ON or at least convert it into VM_BUG_ON.