Re: pass M_CANFAIL to malloc() which use M_WAITOK but are tested for failure

2023-04-26 Thread Kevin Lo
On Wed, Apr 26, 2023 at 08:19:10PM +0200, Alexander Bluhm wrote: > > On Sat, Apr 15, 2023 at 10:44:15PM +0800, Kevin Lo wrote: > > On Fri, Apr 14, 2023 at 02:01:29PM +0200, Alexander Bluhm wrote: > > > I think you are trying to change the kernel in the wrong direction. > > > It should not fail,

Re: pass M_CANFAIL to malloc() which use M_WAITOK but are tested for failure

2023-04-26 Thread Alexander Bluhm
On Sat, Apr 15, 2023 at 10:44:15PM +0800, Kevin Lo wrote: > On Fri, Apr 14, 2023 at 02:01:29PM +0200, Alexander Bluhm wrote: > > I think you are trying to change the kernel in the wrong direction. > > It should not fail, but handle the requests. Panic if there is a > > bug. > > > > Why do you

Re: pass M_CANFAIL to malloc() which use M_WAITOK but are tested for failure

2023-04-15 Thread Kevin Lo
On Fri, Apr 14, 2023 at 02:01:29PM +0200, Alexander Bluhm wrote: > > On Thu, Apr 13, 2023 at 10:43:30AM +0800, Kevin Lo wrote: > > M_CANFAIL > > In the M_WAITOK case, if not enough memory is available, > > return NULL instead of calling panic(9). If mallocarray() > > Did you see such

Re: pass M_CANFAIL to malloc() which use M_WAITOK but are tested for failure

2023-04-14 Thread Alexander Bluhm
On Thu, Apr 13, 2023 at 10:43:30AM +0800, Kevin Lo wrote: > M_CANFAIL > In the M_WAITOK case, if not enough memory is available, > return NULL instead of calling panic(9). If mallocarray() Did you see such a panic? If yes it would be better to understand and fix the root cause. >

Re: pass M_CANFAIL to malloc() which use M_WAITOK but are tested for failure

2023-04-12 Thread Kevin Lo
On Thu, Apr 06, 2023 at 02:09:23PM +0200, Alexander Bluhm wrote: > > On Thu, Apr 06, 2023 at 02:58:56PM +0800, Kevin Lo wrote: > > The diff below adds M_CANFAIL to the flag passed to malloc() since we are > > able > > to fail gracefully. > > I would not call a return ENOMEM a gracefull fail. >

Re: pass M_CANFAIL to malloc() which use M_WAITOK but are tested for failure

2023-04-06 Thread Alexander Bluhm
On Thu, Apr 06, 2023 at 02:58:56PM +0800, Kevin Lo wrote: > The diff below adds M_CANFAIL to the flag passed to malloc() since we are able > to fail gracefully. I would not call a return ENOMEM a gracefull fail. Usually if we can wait with M_WAITOK and everyting is fine afterwards, that's a good

pass M_CANFAIL to malloc() which use M_WAITOK but are tested for failure

2023-04-06 Thread Kevin Lo
Hi, The diff below adds M_CANFAIL to the flag passed to malloc() since we are able to fail gracefully. ok? Index: sys/dev/pci/if_igc.c === RCS file: /cvs/src/sys/dev/pci/if_igc.c,v retrieving revision 1.12 diff -u -p -u -p -r1.12