[Drbd-dev] [PATCH] drbd: Avoid GFP_KERNEL allocation from alloc_send_buffer()

Philipp Reisner philipp.reisner at linbit.com
Thu Apr 25 15:51:02 CEST 2019


Hi Tetsuo,

[...]
> Due to 'The "too small to fail" memory-allocation rule'
> ( https://lwn.net/Articles/627419/ ), I think that this allocation
> would loop forever inside the page allocator until somebody volunteers
> a page because this is called by a kernel thread which won't be killed
> by the OOM killer. That is, __GFP_NOWARN unlikely makes sense.

Without knowing the odds of the kernel allocator (too small to fail) for
me it "feels" right to mark that a failing allocations should not even
be logged. It is not the slightest problem at this point.
 
> What happens if nobody volunteers a page when current thread is
> calling new_or_recycle_send_buffer_page() ? In other words, may I ask
> the reason why GFP_NOIO is safe here?

We always have one buffer page allocated. When the previous send_page()
finishes this buffer page gets recycled (it's page count drops to 1).
If the system has free memory for DRBD we are happy to use a new page 
as the next buffer page, speeding up things, as we do not need to wait
for previous data to be finally sent.
It is guaranteed that we make progress here. Either because we get
memory (a) or because the previous buffer becomes reusable (b).

best regards,
 Phil
-- 
LINBIT | Keeping The Digital World Running

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.





More information about the drbd-dev mailing list