Re: [PATCH v5] mm/page_alloc: only update lowmem_reserve_ratio on sysctl write
Andrew Morton <[email protected]>
| Newsgroups | gmane.linux.kernel,gmane.linux.kernel.mm |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 6 Aug 2026 09:50:16 -0400 Johannes Weiner <[email protected]> wrote: > > - proc_dointvec_minmax(table, write, buffer, length, ppos); > > + if (!write) > > + return proc_dointvec_minmax(table, write, buffer, length, ppos); > > > > - for (i = 0; i < MAX_NR_ZONES; i++) { > > - if (sysctl_lowmem_reserve_ratio[i] < 1) > > - sysctl_lowmem_reserve_ratio[i] = 0; > > - } > > This could use a comment. How about: > > /* > * proc_dointvec_max() works incrementally. Use a buffer > * and only set the values if all of them parse cleanly. > */ > I added a fixlet: --- a/mm/page_alloc.c~mm-page_alloc-only-update-lowmem_reserve_ratio-on-sysctl-write-fix +++ a/mm/page_alloc.c @@ -6932,6 +6932,10 @@ static int lowmem_reserve_ratio_sysctl_h if (!write) return proc_dointvec_minmax(table, write, buffer, length, ppos); + /* + * proc_dointvec_max() works incrementally. Use a buffer and only set + * the values if all of them parse cleanly. + */ memcpy(ratio, sysctl_lowmem_reserve_ratio, sizeof(ratio)); tmp.data = ratio; _ Sashiko got all upset about concurrency issues: https://sashiko.dev/#/patchset/[email protected] But I think I'm hearing from Joel is that the longer-term plan is to fix all this up within proc_dointvec_minmax()?