Re: [PATCH] mm: make __GFP_SKIP_ZERO visible to skip zero operation

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

 



Eric Biggers <ebiggers@xxxxxxxxxx> writes:

> On Mon, Sep 04, 2023 at 10:34:25AM -0700, Linus Torvalds wrote:
>> On Mon, 4 Sept 2023 at 00:55, Michal Hocko <mhocko@xxxxxxxx> wrote:
>> >
>> >       Sooner or later this will become an
>> > unreviewable mess so the value of init_on_alloc will become very
>> > dubious.
>> 
>> The value of init_on_alloc is *already* very dubious.
>> 
>> Exactly because people will turn it off, because it hurts performance
>> so much - and in pointless ways.
>> 
>> You do realize that distributions - well, at least Fedora - simply
>> don't turn INIT_ON_ALLOC_DEFAULT_ON on at all?
>> 
>> So the current state of init_on_alloc is that nobody sane uses it. You
>> have to think you're special to enable it, because it is *so* bad.
>> 
>> Security people need to realize that the primary point of computing is
>> NEVER EVER security. Security is entirely pointless without a usable
>> system.
>> 
>> Unless security people realize that they are always secondary, they
>> aren't security people, they are just random wankers.
>> 
>> And people who state this truism had better not get shamed for
>> standing up to stupidity.
>> 
>
> Android and Ubuntu both set CONFIG_INIT_ON_ALLOC_DEFAULT_ON.  I think this makes
> it clear that the init-on-alloc feature is useful for a substantial amount of
> users even in its current form.
>
> I would caution against checking the kernel config for the distro you happen to
> be using and extrapolating that to all Linux systems.
>
> Regardless, I'm in favor of a per allocation opt-out flag like GFP_SKIP_ZERO.
> There are clear cases where it makes sense, for example some places in the VFS
> where the performance impact is large and the code has been carefully reviewed.

The performance impact for some drivers is also large. This came up
recently where we've seen some large (2-3x) slowdowns with our GPU
driver on some systems with Ubuntu due to having init_on_alloc
enabled. This is exacerbated by the fact drivers can't rely on having
this option set and would generally rather zero memory themselves with
faster DMA engines or by overwitting it directly with valid data. So the
end result is memory gets zeroed/initialised twice and we have to
recommend our users turn this off anyway.

So a per-allocation flag would be nice. Of course I'm not claiming
driver code has been as carefully reviewed as VFS code so maybe there is
need for an override, but the performance impact is large. If it would
be helpful/motivating I can get actual performance numbers that show the
impact to post here.

> I don't really like the idea
> (https://lore.kernel.org/lkml/CAG_fn=UQEuvJ9WXou_sW3moHcVQZJ9NvJ5McNcsYE8xw_WEYGw@xxxxxxxxxxxxxx/)
> of making the system administrator have to opt out allocation sites individually
> via a kernel command-line parameter.  Yes, it makes the opt out less likely to
> be abused as two parties (developer and system administrator) have to consent to
> each individual opt out.  So it theory it sounds good.  But I feel that doesn't
> outweigh the fact that it would be complicated and hard to use.  How about just
> having two options: one to always honor GFP_SKIP_ZERO in the code and one to
> always ignore it.
>
> - Eric





[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