All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Dobson <colpatch@us.ibm.com>
To: Christoph Rohland <cr@sap.com>
Cc: linux-mm@kvack.org, William Lee Irwin III <wli@holomorphy.com>,
	"Martin J. Bligh" <mbligh@aracnet.com>
Subject: Re: [question] shm_nattch in sys_shmat?
Date: Mon, 03 Feb 2003 15:43:16 -0800	[thread overview]
Message-ID: <3E3EFE94.2020203@us.ibm.com> (raw)
In-Reply-To: ov4r7lf8mm.fsf@sap.com

Christoph Rohland wrote:
> Hi Matthew,
> 
> On Fri, 31 Jan 2003, Matthew Dobson wrote:
> 
>>	sys_shmat, does in fact increment shm_nattch, but only to
>>	decrement it again a few lines later, as seen in this code
>>	snippet.  Can anyone please explain why this is?
> 
> 
> sys_shmat temporarily increases shm_nattch to make sure it's never zero:
> 
> 
>> >>>	shp->shm_nattch++;
> 
> 
> Make sure shm_nattch is greater than zero.
> 
> 
>> >	user_addr = (void*) do_mmap (file, addr, size, prot,
> 
> 
> map the segment which increments shm_nattch in shm_mmap accounting for
> the actual mapping
> 
> 
>> >>>	shp->shm_nattch--;
> 
> 
> Correct it again.
> 
> Greetings
> 		Christoph

Ah ha...   I hadn't followed the do_mmap call chain deep enough to 
notice that it would call the shm_mmap call through the f_op function 
pointer.  Thanks for pointing that out.  It makes much more sense now. 
A small comment in there would make it *much* more obvious what is going on.

Cheers!

-Matt

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

      reply	other threads:[~2003-02-03 23:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-31 22:35 [question] shm_nattch in sys_shmat? Matthew Dobson
2003-02-03 19:48 ` Christoph Rohland
2003-02-03 23:43   ` Matthew Dobson [this message]

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=3E3EFE94.2020203@us.ibm.com \
    --to=colpatch@us.ibm.com \
    --cc=cr@sap.com \
    --cc=linux-mm@kvack.org \
    --cc=mbligh@aracnet.com \
    --cc=wli@holomorphy.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.