Nathan Lynch <nath...@linux.ibm.com> writes: > Michael Ellerman <m...@ellerman.id.au> writes: >> One thought, which I possibly should not put in writing, is that we >> could use the alignment of the pointer as a poor man's substitute for a >> counter, eg: >> >> +static inline struct drmem_lmb *drmem_lmb_next(struct drmem_lmb *lmb) >> +{ >> + if (lmb % PAGE_SIZE == 0) >> + cond_resched(); >> + >> + return ++lmb; >> +} >> >> I think the lmbs are allocated in a block, so I think that will work. >> Maybe PAGE_SIZE is not the right size to use, but you get the idea. >> >> Gross I know, but might be OK as short term solution? > > OK, looking into this.
To follow up: I wasn't able to measure more than ~1% difference in DLPAR memory performance with my original version of this, but that was on a relatively small configuration - hundreds of elements in the array as opposed to thousands. I took an educated guess at an appropriate interval and posted v2: https://lore.kernel.org/linuxppc-dev/20200812012005.1919255-1-nath...@linux.ibm.com/