On Fri, Apr 24, 2026 at 08:46:24AM +0800, SUVONOV BUNYOD wrote: > Thank you for reviewing Shakeel, > > > Do we need to trace highest_zoneidx at the end? Can it change within > > balance_pgdat()? > > highest_zoneidx does not change within a balance_pgdat() invocation. It > is passed in as an argument and remains the classzone bound used for the > balancing checks throughout the function. > > I kept highest_zoneidx in the end tracepoint to make the outcome event > self-contained. In principle, begin/end correlation is possible, but > under sustained memory pressure kswapd reclaim can be frequent enough > that consumers may prefer to analyze end events directly, and any > dependence on matching begin/end becomes less convenient and less robust > in the presence of filtering or dropped trace records. > > Since nr_reclaimed and the final order are only known at the end, having > highest_zoneidx there allows end-only analysis without correlating with > the begin event. > > For example, it lets users answer questions like: > - this pass reclaimed too much or too little memory; what highest_zoneidx > did that result correspond to? > - how much reclaim was done when balancing up to ZONE_NORMAL vs other > classzone bounds? > - when highest_zoneidx == ZONE_NORMAL, how often did reclaim finish at > order=0? > > So it is there because it provides context for the end-of-reclaim result. > Do you think this is sufficient justification? If not, then I can drop it > from the end tracepoint in v2.
I think it is ok but let's add this reasoning in the commit message.
