From: Michael Kelley <mhkli...@outlook.com> Current deferred I/O code works only for framebuffer memory that is allocated with vmalloc(). The code assumes that the underlying page refcount can be used by the mm subsystem to manage each framebuffer page's lifecycle, which is consistent with vmalloc'ed memory, but not with contiguous kernel memory from alloc_pages() or similar. When used with contiguous kernel memory, current deferred I/O code eventually causes the memory free lists to be scrambled, and a kernel panic ensues. The problem is seen with the hyperv_fb driver when mmap'ing the framebuffer into user space, as that driver uses alloc_pages() for the framebuffer in some configurations. This patch set fixes the problem by supporting contiguous kernel memory framebuffers with deferred I/O.
Patch 1 exports a 'mm' subsystem function needed by Patch 2. Patch 2 is the changes to the fbdev deferred I/O code. More details are in the commit message of Patch 2. Patch 3 updates the hyperv_fb driver to use the new functionality from Patch 2. Michael Kelley (3): mm: Export vmf_insert_mixed_mkwrite() fbdev/deferred-io: Support contiguous kernel memory framebuffers fbdev: hyperv_fb: Fix mmap of framebuffers allocated using alloc_pages() drivers/video/fbdev/core/fb_defio.c | 128 +++++++++++++++++++++++----- drivers/video/fbdev/hyperv_fb.c | 1 + include/linux/fb.h | 1 + mm/memory.c | 1 + 4 files changed, 111 insertions(+), 20 deletions(-) -- 2.25.1