On Mon 21-10-24 10:51:43, Joshua Hahn wrote: > > On Mon, Oct 21, 2024 at 3:15 AM Michal Hocko <mhocko@xxxxxxxx> wrote: > > > On Fri 18-10-24 14:38:48, Joshua Hahn wrote: > > > But even if we are okay with this, I think it might be overkill to > > > enable the hugeTLB controller for the convenience of being able to inspect > > > the hugeTLB usage for cgroups. This is especially true in workloads where > > > we can predict what usage patterns will be like, and we do not need to enforce > > > specific limits on hugeTLB usage. > > > > I am sorry but I do not understand the overkill part of the argument. > > Is there any runtime or configuration cost that is visible? > > I think an argument could be made that any amount of incremental overhead > is unnecessary. With that said however, I think a bigger reason why this is > overkill is that a user who wishes to use the hugeTLB counter (which this > patch achieves in ~10 lines) should not have to enable a ~1000 line feature, > as Johannes suggested. > > A diligent user will have to spend time learning how the hugeTLB controller > works and figuring out the settings that will basically make the controller > do no enforcing (and basically, the same as if the feature was not enabled). > A not-so-diligent user will not spend the time to make sure that the configs > make sense, and may run into unexpected & unwanted hugeTLB behavior [1]. Heh, a lazy user would just enable the controller and hope for the best. And it would actually worked out of the box because there is no limit imposed by default so the only downside is a theoretical overhead due to charging. Anyway, I get the point and I guess it is fair to say the half baked memcg accounting is not optimal because it only provides half baked insight and you aim to fix that. This is fair intentention and justification. I have to say I really disliked this extension to the memcg when it was proposed but it was claimed this was good enough for people who know what they are doing. > > TL;DR > > 1) you need to make the stats accounting aligned with the existing > > charge accounting. > > 2) make the stat visible only when feature is enabled > > 3) work more on the justification - i.e. changelog part and give us a > > better insight why a) hugetlb cgroup is seen is a bad choice and b) why > > the original limitation hasn't proven good since the feature was > > introduced. > > > > Makes sense? > > -- > > Michal Hocko > > SUSE Labs > > Hi Michal, > > Thank you for your input. Yes -- this makes sense to me. I apologize, as it > seems that I definitely left a lot to be assumed & inferred, based on my > original patch changelog. > > In my next version of this patch, I am planning to add the changes that have > been suggested by Johannes, write code with the try_charge cleanup that > Shakeel suggested in mind, and change the behavior to make sense only when > hugeTLB accounting is enabled, as you suggested as well. I'll also update > the changelog & commit message and add any information that will hopefully > make future reviewers aware of the motivation for this patch. Thanks a lot! > Please let me know if you have any remaining concerns with the implementation > or motivation, and I will be happy to incorporate your ideas into the next > version as well. I think clarification and fixing the reporting is good enough. This still won't make the hugetlb sneaking into memcg more likeable to me but nothing that would force me awake during nights ;) Thanks! -- Michal Hocko SUSE Labs