virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2 1/8] mm: slab: provide krealloc_array()
       [not found] ` <20201102152037.963-2-brgl@bgdev.pl>
@ 2020-11-02 15:41   ` Matthew Wilcox
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Wilcox @ 2020-11-02 15:41 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: alsa-devel, kvm, Michael S . Tsirkin, David Airlie,
	Gustavo Padovan, Linus Walleij, dri-devel, Jaroslav Kysela,
	linux-mm, Christoph Lameter, Sumit Semwal, Mauro Carvalho Chehab,
	Bartosz Golaszewski, Alexander Shishkin, David Rientjes,
	virtualization, linux-media, Robert Richter, Thomas Zimmermann,
	Maarten Lankhorst, Maxime Ripard, linaro-mm-sig, linux-gpio,
	Borislav Petkov, Andy Shevchenko, Andrew Morton, Vlastimil Babka,
	linux-edac, Tony Luck, netdev, Takashi Iwai, linux-kernel,
	Pekka Enberg, James Morse, Daniel Vetter, Joonsoo Kim,
	Christian König

On Mon, Nov 02, 2020 at 04:20:30PM +0100, Bartosz Golaszewski wrote:
> +Chunks allocated with `kmalloc` can be resized with `krealloc`. Similarly
> +to `kmalloc_array`: a helper for resising arrays is provided in the form of
> +`krealloc_array`.

Is there any reason you chose to `do_this` instead of do_this()?  The
automarkup script turns do_this() into a nice link to the documentation
which you're adding below.

Typo 'resising' resizing.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 8/8] dma-buf: use krealloc_array()
       [not found] ` <20201102152037.963-9-brgl@bgdev.pl>
@ 2020-11-02 16:10   ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2020-11-02 16:10 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: alsa-devel, kvm, Michael S . Tsirkin, David Airlie,
	Gustavo Padovan, Linus Walleij, dri-devel, Jaroslav Kysela,
	linux-mm, Christoph Lameter, Sumit Semwal, Bartosz Golaszewski,
	Alexander Shishkin, David Rientjes, virtualization, linux-media,
	Robert Richter, Thomas Zimmermann, Maarten Lankhorst,
	Maxime Ripard, linaro-mm-sig, linux-gpio, Borislav Petkov,
	Mauro Carvalho Chehab, Joonsoo Kim, linux-edac, Tony Luck, netdev,
	Takashi Iwai, linux-kernel, Pekka Enberg, James Morse,
	Daniel Vetter, Andrew Morton, Christian König

On Mon, Nov 02, 2020 at 04:20:37PM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Use the helper that checks for overflows internally instead of manually
> calculating the size of the new array.

...

> +		nfences = krealloc_array(fences, i,
> +					 sizeof(*fences), GFP_KERNEL);

On 80 position is closing parenthesis, which, I think, makes it okay to put on
one line.

-- 
With Best Regards,
Andy Shevchenko


_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/8] slab: provide and use krealloc_array()
       [not found] <20201102152037.963-1-brgl@bgdev.pl>
       [not found] ` <20201102152037.963-2-brgl@bgdev.pl>
       [not found] ` <20201102152037.963-9-brgl@bgdev.pl>
@ 2020-11-03  4:14 ` Joe Perches
       [not found]   ` <CAMRc=Me4-4Cmoq3UdpYEEhERP6fvt97bEJsZYhrcFSQf+a_voA@mail.gmail.com>
  2 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2020-11-03  4:14 UTC (permalink / raw)
  To: Bartosz Golaszewski, Andy Shevchenko, Sumit Semwal,
	Gustavo Padovan, Christian König, Mauro Carvalho Chehab,
	Borislav Petkov, Tony Luck, James Morse, Robert Richter,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Daniel Vetter, Alexander Shishkin, Linus Walleij,
	Michael S . Tsirkin, Jason Wang, Christoph Lameter, Pekka Enberg,
	David Rientjes, Joonsoo Kim, Andrew Morton, Jaroslav Kysela,
	Takashi Iwai
  Cc: alsa-devel, kvm, linux-mm, netdev, linux-kernel, dri-devel,
	virtualization, linaro-mm-sig, linux-gpio, Bartosz Golaszewski,
	linux-media, linux-edac

On Mon, 2020-11-02 at 16:20 +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Andy brought to my attention the fact that users allocating an array of
> equally sized elements should check if the size multiplication doesn't
> overflow. This is why we have helpers like kmalloc_array().
> 
> However we don't have krealloc_array() equivalent and there are many
> users who do their own multiplication when calling krealloc() for arrays.
> 
> This series provides krealloc_array() and uses it in a couple places.

My concern about this is a possible assumption that __GFP_ZERO will
work, and as far as I know, it will not.


_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/8] slab: provide and use krealloc_array()
       [not found]   ` <CAMRc=Me4-4Cmoq3UdpYEEhERP6fvt97bEJsZYhrcFSQf+a_voA@mail.gmail.com>
@ 2020-11-03 10:55     ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2020-11-03 10:55 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linux-ALSA, open list:VFIO DRIVER, Michael S . Tsirkin,
	David Airlie, Gustavo Padovan, Linus Walleij,
	open list:DRM PANEL DRIVERS, Jaroslav Kysela, linux-mm,
	Christoph Lameter, Sumit Semwal, Mauro Carvalho Chehab,
	Bartosz Golaszewski, Alexander Shishkin, David Rientjes,
	virtualization, Linux Media Mailing List, Robert Richter,
	Thomas Zimmermann, Maarten Lankhorst, Maxime Ripard,
	linaro-mm-sig, open list:GPIO SUBSYSTEM, Borislav Petkov,
	Andy Shevchenko, Andrew Morton, linux-edac, Tony Luck, netdev,
	Takashi Iwai, Linux Kernel Mailing List, Pekka Enberg,
	James Morse, Daniel Vetter, Joe Perches, Joonsoo Kim,
	Christian König

On Tue, Nov 3, 2020 at 12:13 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> On Tue, Nov 3, 2020 at 5:14 AM Joe Perches <joe@perches.com> wrote:
> > On Mon, 2020-11-02 at 16:20 +0100, Bartosz Golaszewski wrote:
> > > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

> Yeah so I had this concern for devm_krealloc() and even sent a patch
> that extended it to honor __GFP_ZERO before I noticed that regular
> krealloc() silently ignores __GFP_ZERO. I'm not sure if this is on
> purpose. Maybe we should either make krealloc() honor __GFP_ZERO or
> explicitly state in its documentation that it ignores it?

And my voice here is to ignore for the same reasons: respect
realloc(3) and making common sense with the idea of REallocating
(capital letters on purpose).

-- 
With Best Regards,
Andy Shevchenko
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-03 10:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20201102152037.963-1-brgl@bgdev.pl>
     [not found] ` <20201102152037.963-2-brgl@bgdev.pl>
2020-11-02 15:41   ` [PATCH v2 1/8] mm: slab: provide krealloc_array() Matthew Wilcox
     [not found] ` <20201102152037.963-9-brgl@bgdev.pl>
2020-11-02 16:10   ` [PATCH v2 8/8] dma-buf: use krealloc_array() Andy Shevchenko
2020-11-03  4:14 ` [PATCH v2 0/8] slab: provide and " Joe Perches
     [not found]   ` <CAMRc=Me4-4Cmoq3UdpYEEhERP6fvt97bEJsZYhrcFSQf+a_voA@mail.gmail.com>
2020-11-03 10:55     ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).