Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Greg KH
2020-08-28T06:17:18Z

On Thu, Aug 27, 2020 at 05:25:23PM -0700, Iouri Tarassov wrote:
> > > +{
> > > + struct dxgprocess_adapter *adapter_info = dxgmem_alloc(process,
> > > + DXGMEM_PROCESS_ADAPTER,
> > > + sizeof
> > > + (*adapter_info));
> >
> > We normally use kernel functions in kernel code.
> Using a custom memory allocation function allows us to track memory
> allocations per DXGPROCESS and catch memory leaks when a DXGPROCESS is
> destroyed or when the driver is unloaded. It also allows to easily change
> the memory allocation implementation if needed.

There is only one "memory allocation implementation" in the kernel,
please use that and not any wrapper functions. You wouldn't want to see
1000's of different memory allocation functions, each driver having a
unique one, right?

Remember, your code is becoming part of the larger kernel, so follow the
guidelines and rules of it. There is nothing different from your code
and a serial port driver when it comes to these expectations.

thanks,

greg k-h