@@ -224,6 +224,9 @@ func (r *result) adjust(rpl *ContainerAdjustment, plugin string) error {
224224 if err := r .adjustOomScoreAdj (rpl .Linux .OomScoreAdj , plugin ); err != nil {
225225 return err
226226 }
227+ if err := r .adjustMemoryPolicy (rpl .Linux .MemoryPolicy , plugin ); err != nil {
228+ return err
229+ }
227230 }
228231 if err := r .adjustRlimits (rpl .Rlimits , plugin ); err != nil {
229232 return err
@@ -765,6 +768,22 @@ func (r *result) adjustOomScoreAdj(OomScoreAdj *OptionalInt, plugin string) erro
765768 return nil
766769}
767770
771+ func (r * result ) adjustMemoryPolicy (memoryPolicy * LinuxMemoryPolicy , plugin string ) error {
772+ if memoryPolicy == nil {
773+ return nil
774+ }
775+
776+ id := r .request .create .Container .Id
777+
778+ if err := r .owners .claimMemoryPolicy (id , plugin ); err != nil {
779+ return err
780+ }
781+
782+ r .reply .adjust .Linux .MemoryPolicy = memoryPolicy
783+
784+ return nil
785+ }
786+
768787func (r * result ) adjustRlimits (rlimits []* POSIXRlimit , plugin string ) error {
769788 create , id , adjust := r .request .create , r .request .create .Container .Id , r .reply .adjust
770789 for _ , l := range rlimits {
@@ -1004,6 +1023,7 @@ type owners struct {
10041023 unified map [string ]string
10051024 cgroupsPath string
10061025 oomScoreAdj string
1026+ memoryPolicy string
10071027 rlimits map [string ]string
10081028}
10091029
@@ -1128,6 +1148,10 @@ func (ro resultOwners) claimOomScoreAdj(id, plugin string) error {
11281148 return ro .ownersFor (id ).claimOomScoreAdj (plugin )
11291149}
11301150
1151+ func (ro resultOwners ) claimMemoryPolicy (id , plugin string ) error {
1152+ return ro .ownersFor (id ).claimMemoryPolicy (plugin )
1153+ }
1154+
11311155func (ro resultOwners ) claimRlimits (id , typ , plugin string ) error {
11321156 return ro .ownersFor (id ).claimRlimit (typ , plugin )
11331157}
@@ -1389,6 +1413,14 @@ func (o *owners) claimOomScoreAdj(plugin string) error {
13891413 return nil
13901414}
13911415
1416+ func (o * owners ) claimMemoryPolicy (plugin string ) error {
1417+ if other := o .memoryPolicy ; other != "" {
1418+ return conflict (plugin , other , "memory policy" )
1419+ }
1420+ o .memoryPolicy = plugin
1421+ return nil
1422+ }
1423+
13921424func (ro resultOwners ) clearAnnotation (id , key string ) {
13931425 ro .ownersFor (id ).clearAnnotation (key )
13941426}
0 commit comments