linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Doubt in do_no_page()
@ 2004-01-21 15:47 Anand Eswaran
  2004-01-21 16:16 ` logan
  0 siblings, 1 reply; 6+ messages in thread
From: Anand Eswaran @ 2004-01-21 15:47 UTC (permalink / raw)
  To: linux-mm

Hi all :

  I have a doubt regarding the do_no_page function in memory.c. I would
greatly appreciate it if someone could help me out.


My questions are appended ( they're between the lines ) near the
corresponding code of concern.





int do_no_page(struct mm_struct * mm,
	               struct vm_area_struct * vma,
	               unsigned long address,
	               int write_access,
	               pte_t *page_table)


	struct page * new_page;
	pte_t entry;

	if (!vma->vm_ops || !vma->vm_ops->nopage)
		return do_anonymous_page(mm, vma, page_table, write_access, address);

QUESTION
------------------------------------------------------------------------

 I assume that most faults would be serviced by the do_anonymous page i.e
for most "normal" vma's ( say heap ) the vma->vm_ops->nopage would be
NULL. Is that true?


------------------------------------------------------------------------

	spin_unlock(&mm->page_table_lock);

	new_page = vma->vm_ops->nopage(vma, address & PAGE_MASK, 0);

	if (new_page == NULL)	/* no page was available -- SIGBUS */
		return 0;
	if (new_page == NOPAGE_OOM)
		return -1;


QUESTION
-----------------------------------------------------------------------

1) What type of vma's come here ?
------------------------------------------------------------------------



	/*
	 * Should we do an early C-O-W break?
	 */
	if (write_access && !(vma->vm_flags & VM_SHARED)) {
		struct page * page = alloc_page(GFP_HIGHUSER);
		if (!page) {
			page_cache_release(new_page);
			return -1;
		}
		copy_user_highpage(page, new_page, address);
		page_cache_release(new_page);
		lru_cache_add(page);
		new_page = page;
	}

	spin_lock(&mm->page_table_lock);
	/*
	 * This silly early PAGE_DIRTY setting removes a race
	 * due to the bad i386 page protection. But it's valid
	 * for other architectures too.
	 *
	 * Note that if write_access is true, we either now have
	 * an exclusive copy of the page, or this is a shared mapping,
	 * so we can make it writable and dirty to avoid having to
	 * handle that later.
	 */
	/* Only go through if we didn't race with anybody else... */
	if (pte_none(*page_table)) {
		++mm->rss;
		flush_page_to_ram(new_page);
		flush_icache_page(vma, new_page);
		entry = mk_pte(new_page, vma->vm_page_prot);
		if (write_access)
			entry = pte_mkwrite(pte_mkdirty(entry));
		set_pte(page_table, entry);
	} else {
		/* One of our sibling threads was faster, back out. */
		page_cache_release(new_page);
		spin_unlock(&mm->page_table_lock);
		return 1;
	}

	/* no need to invalidate: a not-present page shouldn't be cached */
	update_mmu_cache(vma, address, entry);
	spin_unlock(&mm->page_table_lock);
	return 2;	/* Major fault */




I would greatly appreciate if someone could answer this for me in some depth.

Thanks a lot,
------
Anand.






--
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/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

* Re: Doubt in do_no_page()
  2004-01-21 15:47 Doubt in do_no_page() Anand Eswaran
@ 2004-01-21 16:16 ` logan
  2004-01-21 16:35   ` Randy.Dunlap
  2004-01-21 16:51   ` Anand Eswaran
  0 siblings, 2 replies; 6+ messages in thread
From: logan @ 2004-01-21 16:16 UTC (permalink / raw)
  To: Anand Eswaran; +Cc: linux-mm


On Wed, 21 Jan 2004, Anand Eswaran wrote:

>+1 	if (!vma->vm_ops || !vma->vm_ops->nopage)
>+2 		return do_anonymous_page(mm, vma, page_table, write_access, address);
>
> QUESTION
> ------------------------------------------------------------------------
>
>  I assume that most faults would be serviced by the do_anonymous page i.e
> for most "normal" vma's ( say heap ) the vma->vm_ops->nopage would be
> NULL. Is that true?
> ------------------------------------------------------------------------

 No Anand, the page fault is passed to do_anonymous_page
 if vma ( say heap ) does not have its own page processing
 functions ( i.e. ->vm_ops ), the check is made on those first,
 its !vma->vm_ops, and if it has such, the same goes for !vm_ops->nopage.

 You got wrong to for a while.
 But i think code is ok.

 -- Alex
--
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/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

* Re: Doubt in do_no_page()
  2004-01-21 16:16 ` logan
@ 2004-01-21 16:35   ` Randy.Dunlap
  2004-01-21 17:08     ` logan
  2004-01-21 17:11     ` logan
  2004-01-21 16:51   ` Anand Eswaran
  1 sibling, 2 replies; 6+ messages in thread
From: Randy.Dunlap @ 2004-01-21 16:35 UTC (permalink / raw)
  To: linux-mm

On Wed, 21 Jan 2004 18:16:50 +0200 (EET) logan@osdl.org wrote:


| 
|  -- Alex


Are you really logan@osdl.org ??
(Hint:  I can't send email to that address.)

or do you have forged or misconfigured mail headers?

--
~Randy
--
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/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

* Re: Doubt in do_no_page()
  2004-01-21 16:16 ` logan
  2004-01-21 16:35   ` Randy.Dunlap
@ 2004-01-21 16:51   ` Anand Eswaran
  1 sibling, 0 replies; 6+ messages in thread
From: Anand Eswaran @ 2004-01-21 16:51 UTC (permalink / raw)
  To: logan; +Cc: linux-mm

Hi :

    Im sorry , I should have been clearer with my question. I guess my
question is what are typical examples of vma's don't get through from
the do_no_page to the do_anonymous_page

   OR rephrased

  I would like examples of ("typical", if there are)  vma's dont have any
operations or have no nopage() routine defined on them .

  Thanks a lot for replying though.

Regards,
-----
Anand.


--
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/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

* Re: Doubt in do_no_page()
  2004-01-21 16:35   ` Randy.Dunlap
@ 2004-01-21 17:08     ` logan
  2004-01-21 17:11     ` logan
  1 sibling, 0 replies; 6+ messages in thread
From: logan @ 2004-01-21 17:08 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: linux-mm


On Wed, 21 Jan 2004, Randy.Dunlap wrote:

> On Wed, 21 Jan 2004 18:16:50 +0200 (EET) logan@osdl.org wrote:
>
>
> |
> |  -- Alex
>
>
> Are you really logan@osdl.org ??
> (Hint:  I can't send email to that address.)
>
> or do you have forged or misconfigured mail headers?
>
> --
> ~Randy
> --

 Randy, sorry for this, i will change it.


 for personal contact -- whois@list.ru

 -- Alex
--
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/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

* Re: Doubt in do_no_page()
  2004-01-21 16:35   ` Randy.Dunlap
  2004-01-21 17:08     ` logan
@ 2004-01-21 17:11     ` logan
  1 sibling, 0 replies; 6+ messages in thread
From: logan @ 2004-01-21 17:11 UTC (permalink / raw)
  To: linux-mm


On Wed, 21 Jan 2004, Randy.Dunlap wrote:

> On Wed, 21 Jan 2004 18:16:50 +0200 (EET) logan@osdl.org wrote:
>
>
> |
> |  -- Alex
>
>
> Are you really logan@osdl.org ??
> (Hint:  I can't send email to that address.)
>
> or do you have forged or misconfigured mail headers?
>
> --
> ~Randy
> --

  Sorry Randy, i forgot about that.

  for personal contact -- whois@list.ru

  -- Alex



--
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/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

end of thread, other threads:[~2004-01-21 17:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-21 15:47 Doubt in do_no_page() Anand Eswaran
2004-01-21 16:16 ` logan
2004-01-21 16:35   ` Randy.Dunlap
2004-01-21 17:08     ` logan
2004-01-21 17:11     ` logan
2004-01-21 16:51   ` Anand Eswaran

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