Re: [PATCH] zsmalloc: correct fragile [kmap|kunmap]_atomic use

Andrew Morton
2014-11-18T23:34:27Z

On Wed, 19 Nov 2014 08:21:39 +0900 Minchan Kim <minchan@kernel.org> wrote:

> Main reason I sent the patch is I got a subtle bug when I implement
> new feature of zsmalloc(ie, compaction) due to link's mishandling
> (ie, link was over page boundary by my fault).
> Although it was totally my mistake, it took time for a while
> to find a root cause because unpredictable kmapped address should
> be unmapped so it's almost random crash.

Fair enough.

That's pretty rude behaviour from kunmap_atomic(). Unfortunately it
just doesn't have anything with which to check the address - we'd need
to create a special per-cpu array[KM_TYPE_NR] just for the purpose.