Kernel Newbies archive on lore.kernel.org
 help / color / Atom feed
From: Greg KH <greg@kroah.com>
To: "孙世龙 sunshilong" <sunshilong369@gmail.com>
Cc: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>,
	Kernelnewbies@kernelnewbies.org
Subject: Re: Are there some potential problems that I should be aware of if I allocate the memory which doesn't have any relation to peripheral hardwares(i.e. DMA, PCI, serial port and etc) by vmalloc() instead of kmalloc()?
Date: Sat, 27 Jun 2020 07:23:06 +0200
Message-ID: <20200627052306.GA248434@kroah.com> (raw)
In-Reply-To: <CAAvDm6ZDg6Lp96pRpbaHqiMNzphbz=WBJBwi6tUNQTJwy_9cew@mail.gmail.com>

On Sat, Jun 27, 2020 at 01:16:50PM +0800, 孙世龙 sunshilong wrote:
> >So as per the above - you allocate one struct array at driver load time for
> >this stuff.  You already know how big the structure/array has to be based on
> >the maximum number of devices or whatever you're trying to track.
> >And if you don't know the maximum, you're not doing real time programming. Or
> >at least not correctly.
> Not at the driver load time, but the load time of the real-time
> process(i.e. before
> the entry of the main() function). It needs to allocate(i.e. use
> vmalloc) a huge memory
> (i.e. for example 80MB, maybe 50MB (how much memory is suitable is decided by
> the specific applications.) used by the user application later. And
> that's ok to allocate
> so huge memory size by vmalloc() and no error complained by the kernel.

Applications do not allocate kernel memory at all, that's up to a kernel
driver.  Userspace does things in totally different ways.

Again, do you have a pointer to your kernel source code that is doing
this allocation that is failing?

thanks,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-26  8:30 孙世龙 sunshilong
2020-06-26 14:13 ` Greg KH
2020-06-26 15:36   ` 孙世龙 sunshilong
2020-06-26 17:22     ` Valdis Klētnieks
2020-06-27  5:16       ` 孙世龙 sunshilong
2020-06-27  5:23         ` Greg KH [this message]
2020-06-27  6:00           ` 孙世龙 sunshilong
2020-06-27  7:05             ` Greg KH
2020-06-27  5:05     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200627052306.GA248434@kroah.com \
    --to=greg@kroah.com \
    --cc=Kernelnewbies@kernelnewbies.org \
    --cc=sunshilong369@gmail.com \
    --cc=valdis.kletnieks@vt.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Kernel Newbies archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org
	public-inbox-index kernelnewbies

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git