lkml.org 
[lkml]   [2020]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] scsi: libcxgbi: use kvzalloc instead of opencoded kzalloc/vzalloc
From
Date
On Sat, 2020-08-01 at 10:51 +0300, Denis Efremov wrote:
> On 8/1/20 1:24 AM, Joe Perches wrote:
> > On Sat, 2020-08-01 at 01:10 +0300, Denis Efremov wrote:
> > > On 8/1/20 12:58 AM, Joe Perches wrote:
> > > > On Sat, 2020-08-01 at 00:55 +0300, Denis Efremov wrote:
> > > > > Remove cxgbi_alloc_big_mem(), cxgbi_free_big_mem() functions
> > > > > and use kvzalloc/kvfree instead.
> > > >
> > > > Sensible, thanks.
> > > >
> > > > > diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
> > > > []
> > > > > @@ -77,9 +77,9 @@ int cxgbi_device_portmap_create(struct cxgbi_device *cdev, unsigned int base,
> > > > > {
> > > > > struct cxgbi_ports_map *pmap = &cdev->pmap;
> > > > >
> > > > > - pmap->port_csk = cxgbi_alloc_big_mem(max_conn *
> > > > > - sizeof(struct cxgbi_sock *),
> > > > > - GFP_KERNEL);
> > > > > + pmap->port_csk = kvzalloc(array_size(max_conn,
> > > > > + sizeof(struct cxgbi_sock *)),
> > > > > + GFP_KERNEL);
> > > >
> > > > missing __GFP_NOWARN
> > > >
> > >
> > > kvmalloc_node adds __GFP_NOWARN internally to kmalloc call
> > > https://elixir.bootlin.com/linux/v5.8-rc4/source/mm/util.c#L568
> >
> > Only when there's a fallback, and the fallback does not.
> Sorry, Joe, I don't understand why do we need to add __GFP_NOWARN here.

Hi.

The reason to add __GFP_NOWARN is so you don't get a
dump_stack() as there's an existing error message
output below this when OOM.

You should either remove the error message as it just
effectively duplicates the dump_stack or add __GFP_NOWARN.

Your choice.

cheers, Joe

\
 
 \ /
  Last update: 2020-08-01 10:11    [W:0.073 / U:2.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site