Re: [PATCH] mm: remove redundant clear page when CONFIG_INIT_ON_ALLOC_DEFAULT_ON configured

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon 11-09-23 14:12:26, Michal Hocko wrote:
> On Mon 11-09-23 18:49:06, zhaoyang.huang wrote:
> > From: Zhaoyang Huang <zhaoyang.huang@xxxxxxxxxx>
> > 
> > There will be redundant clear page within vma_alloc_zeroed_movable_folio
> > when CONFIG_INIT_ON_ALLOC_DEFAULT_ON is on. Remove it by judging related
> > configs.
> 
> Thanks for spotting this. I suspect this is a fix based on a code review
> rather than a real performance issue, right? It is always good to
> mention that. From a very quick look it seems that many architectures
> just definte vma_alloc_zeroed_movable_folio to use __GFP_ZERO so they
> are not affected by this. This means that only a subset of architectures
> are really affected. This is an important information as well.
> Finally I think it would be more appropriate to mention that the double
> initialization is done when init_on_alloc is enabled rather than
> referring to the above config option which only controls whether the
> functionality is enabled by default.
> 
> I would rephrase as follows:
> Many architectures (alpha, arm64, ia64, m68k s390, x86) define their own
> vma_alloc_zeroed_movable_folio implementations which use __GFP_ZERO for
> the page allocation.
> 
> Those which rely on the default implementation, however, would currently
> go through the initialization twice (oce in the page allocator and
> second in vma_alloc_zeroed_movable_folio) if init_on_alloc is enabled
> though. Fix this by checking want_init_on_alloc before calling
> clear_user_highpage.

Btw. have you checked other places which could have a similar problem?
>From a very quick look __do_huge_pmd_anonymous_page, hugetlb_no_page,
hugetlbfs_fallocate and shmem_mfill_atomic_pte all follow the same
pattern. They do allocate memory so they go through the initialization
in the allocator and then reinitialized.

-- 
Michal Hocko
SUSE Labs




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux