On Mon, Mar 11, 2019 at 12:32:33PM -0400, Joel Fernandes wrote: > On Sun, Mar 10, 2019 at 01:34:03PM -0700, Sultan Alsawaf wrote: > [...] > > > > /* Perform scheduler related setup. Assign this task to a CPU. */ > > retval = sched_fork(clone_flags, p); > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > > index 3eb01dedf..fd0d697c6 100644 > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -67,6 +67,7 @@ > > #include <linux/lockdep.h> > > #include <linux/nmi.h> > > #include <linux/psi.h> > > +#include <linux/simple_lmk.h> > > > > #include <asm/sections.h> > > #include <asm/tlbflush.h> > > @@ -967,6 +968,11 @@ static inline void __free_one_page(struct page *page, > > } > > } > > > > +#ifdef CONFIG_ANDROID_SIMPLE_LMK > > + if (simple_lmk_page_in(page, order, migratetype)) > > + return; > > +#endif > > + > > list_add(&page->lru, &zone->free_area[order].free_list[migratetype]); > > out: > > zone->free_area[order].nr_free++; > > @@ -4427,6 +4433,13 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, > > if (costly_order && !(gfp_mask & __GFP_RETRY_MAYFAIL)) > > goto nopage; > > > > +#ifdef CONFIG_ANDROID_SIMPLE_LMK > > + page = simple_lmk_oom_alloc(order, ac->migratetype); > > + if (page) > > + prep_new_page(page, order, gfp_mask, alloc_flags); > > + goto got_pg; > > +#endif > > + > > Hacking generic MM code with Android-specific callback is probably a major > issue with your patch. > > Also I CC'd -mm maintainers and lists since your patch > touches page_alloc.c. Always run get_maintainer.pl before sending a patch. I > added them this time. I see you CC'd linux-mm on your initial patch, so I apologize. Ignore this part of my reply. Thanks. > Have you looked at the recent PSI work that Suren and Johannes have been > doing [1]? As I understand, userspace lmkd may be migrated to use that at some > point. Suren can provide more details. I am sure AOSP contributions to make > LMKd better by using the PSI backend would be appreciated. Please consider > collaborating on that and help out, thanks. Check the cover-letter of that > patch [1] where LMKd is mentioned.