public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* exit_mmap
@ 2003-03-27 14:46 Stephane
  2003-03-27 15:23 ` exit_mmap Stephane
  0 siblings, 1 reply; 2+ messages in thread
From: Stephane @ 2003-03-27 14:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: Stephane Tessier

I have a question about mmap and the close operation of a
vm_area_struct.
Is there a reason why in exit_mmap, when a process dies unexpectedly,
the vm_ops->close is called before zap_page_range is called?

The problem is that if you have allocated one or several kernel pages
for a vm_area_struct, you can not free them in the vm_ops->close
operation since the count field of the pages is not 0 because they are
still mapped. The count will be cleared when zap_page_range is called.

This means that exit_mmap calls vm_ops->close and zap_page_range in the
reverse order of a normal execution of the process, that is when the
process unmap the area before dying.

It would be more deterministic and simple if vm_ops->close was always
called when all the pages of the area was unmapped.

PS: please can you CC'ed the answer to stephane.tessier@netinsight.se
-- 
Stephane Tessier
Net Insight AB          stephane.tessier@netinsight.se
Västberga Allé 9        http://www.netinsight.se
SE-126 30 Hägersten     phone:+46-8-685 04 60
Sweden                  fax:  +46-8-685 04 20

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: exit_mmap
  2003-03-27 14:46 exit_mmap Stephane
@ 2003-03-27 15:23 ` Stephane
  0 siblings, 0 replies; 2+ messages in thread
From: Stephane @ 2003-03-27 15:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Stephane Tessier

Actually I was talking about 2.4.19 but I saw that this was solved in
2.5,
sorry for the disturbance

Stephane wrote:
> 
> I have a question about mmap and the close operation of a
> vm_area_struct.
> Is there a reason why in exit_mmap, when a process dies unexpectedly,
> the vm_ops->close is called before zap_page_range is called?
> 
> The problem is that if you have allocated one or several kernel pages
> for a vm_area_struct, you can not free them in the vm_ops->close
> operation since the count field of the pages is not 0 because they are
> still mapped. The count will be cleared when zap_page_range is called.
> 
> This means that exit_mmap calls vm_ops->close and zap_page_range in the
> reverse order of a normal execution of the process, that is when the
> process unmap the area before dying.
> 
> It would be more deterministic and simple if vm_ops->close was always
> called when all the pages of the area was unmapped.
> 
> PS: please can you CC'ed the answer to stephane.tessier@netinsight.se
> --
> Stephane Tessier
> Net Insight AB          stephane.tessier@netinsight.se
> Västberga Allé 9        http://www.netinsight.se
> SE-126 30 Hägersten     phone:+46-8-685 04 60
> Sweden                  fax:  +46-8-685 04 20

-- 
Stephane Tessier
Net Insight AB          stephane.tessier@netinsight.se
Västberga Allé 9        http://www.netinsight.se
SE-126 30 Hägersten     phone:+46-8-685 04 60
Sweden                  fax:  +46-8-685 04 20

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-27 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-27 14:46 exit_mmap Stephane
2003-03-27 15:23 ` exit_mmap Stephane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox