Skip to content

Commit

Permalink
mm: do not inc NR_PAGETABLE if ptlock_init failed
Browse files Browse the repository at this point in the history
If ALLOC_SPLIT_PTLOCKS is defined, ptlock_init may fail, in which case we
shouldn't increment NR_PAGETABLE.

Since small allocations, such as ptlock, normally do not fail (currently
they can fail if kmemcg is used though), this patch does not really fix
anything and should be considered as a code cleanup.

Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Vladimir Davydov authored and torvalds committed Nov 6, 2015
1 parent 5d3875a commit 706874e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1606,8 +1606,10 @@ static inline void pgtable_init(void)

static inline bool pgtable_page_ctor(struct page *page)
{
if (!ptlock_init(page))
return false;
inc_zone_page_state(page, NR_PAGETABLE);
return ptlock_init(page);
return true;
}

static inline void pgtable_page_dtor(struct page *page)
Expand Down

0 comments on commit 706874e

Please sign in to comment.