> -----Original Message----- > From: charante=codeaurora.org@xxxxxxxxxxxxxxxxx > <charante=codeaurora.org@xxxxxxxxxxxxxxxxx> On Behalf Of Charan Teja > Reddy > Sent: Tuesday, May 18, 2021 6:38 AM > To: akpm@xxxxxxxxxxxxxxxxxxxx; mcgrof@xxxxxxxxxx; > keescook@xxxxxxxxxxxx; yzaikin@xxxxxxxxxx; vbabka@xxxxxxx; Nitin > Gupta <nigupta@xxxxxxxxxx>; bhe@xxxxxxxxxx; > mateusznosek0@xxxxxxxxx; sh_def@xxxxxxx; iamjoonsoo.kim@xxxxxxx; > vinmenon@xxxxxxxxxxxxxx > Cc: linux-kernel@xxxxxxxxxxxxxxx; linux-mm@xxxxxxxxx; linux- > fsdevel@xxxxxxxxxxxxxxx; Charan Teja Reddy <charante@xxxxxxxxxxxxxx> > Subject: [PATCH V2] mm: compaction: support triggering of proactive > compaction by user > > External email: Use caution opening links or attachments > > > The proactive compaction[1] gets triggered for every 500msec and run > compaction on the node for COMPACTION_HPAGE_ORDER (usually order-9) > pages based on the value set to sysctl.compaction_proactiveness. > Triggering the compaction for every 500msec in search of > COMPACTION_HPAGE_ORDER pages is not needed for all applications, > especially on the embedded system usecases which may have few MB's of > RAM. Enabling the proactive compaction in its state will endup in running > almost always on such systems. > You can disable proactive compaction by setting sysctl.compaction_proactiveness to 0. > Other side, proactive compaction can still be very much useful for getting a > set of higher order pages in some controllable manner(controlled by using > the sysctl.compaction_proactiveness). Thus on systems where enabling the > proactive compaction always may proove not required, can trigger the same > from user space on write to its sysctl interface. As an example, say app > launcher decide to launch the memory heavy application which can be > launched fast if it gets more higher order pages thus launcher can prepare > the system in advance by triggering the proactive compaction from > userspace. > You can always do: echo 1 > /proc/sys/vm/compact_memory On a small system, this should not take much time. Hijacking proactive compaction for one-off compaction (say, before a large app launch) does not sound right to me. Thanks, Nitin