All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BUGFIX] mm: fix find_get_page() for shmem exceptional entries
@ 2012-02-07 10:31 ` Konstantin Khlebnikov
  0 siblings, 0 replies; 8+ messages in thread
From: Konstantin Khlebnikov @ 2012-02-07 10:31 UTC (permalink / raw)
  To: linux-mm, Andrew Morton, Hugh Dickins, linux-kernel

It should return NULL, otherwise the caller will be very surprised.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
---
 mm/filemap.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 518223b..ca98cb5 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -693,6 +693,7 @@ repeat:
 			 * here as an exceptional entry: so return it without
 			 * attempting to raise page count.
 			 */
+			page = NULL;
 			goto out;
 		}
 		if (!page_cache_get_speculative(page))


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

* [PATCH BUGFIX] mm: fix find_get_page() for shmem exceptional entries
@ 2012-02-07 10:31 ` Konstantin Khlebnikov
  0 siblings, 0 replies; 8+ messages in thread
From: Konstantin Khlebnikov @ 2012-02-07 10:31 UTC (permalink / raw)
  To: linux-mm, Andrew Morton, Hugh Dickins, linux-kernel

It should return NULL, otherwise the caller will be very surprised.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
---
 mm/filemap.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 518223b..ca98cb5 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -693,6 +693,7 @@ repeat:
 			 * here as an exceptional entry: so return it without
 			 * attempting to raise page count.
 			 */
+			page = NULL;
 			goto out;
 		}
 		if (!page_cache_get_speculative(page))

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH BUGFIX] mm: fix find_get_page() for shmem exceptional entries
  2012-02-07 10:31 ` Konstantin Khlebnikov
@ 2012-02-07 10:43   ` Konstantin Khlebnikov
  -1 siblings, 0 replies; 8+ messages in thread
From: Konstantin Khlebnikov @ 2012-02-07 10:43 UTC (permalink / raw)
  To: linux-mm, Andrew Morton, Hugh Dickins, linux-kernel

Bug was added in commit v3.0-7291-g8079b1c (mm: clarify the radix_tree exceptional cases)
So, v3.1 and v3.2 affected.

Konstantin Khlebnikov wrote:
> It should return NULL, otherwise the caller will be very surprised.
>
> Signed-off-by: Konstantin Khlebnikov<khlebnikov@openvz.org>
> ---
>   mm/filemap.c |    1 +
>   1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 518223b..ca98cb5 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -693,6 +693,7 @@ repeat:
>   			 * here as an exceptional entry: so return it without
>   			 * attempting to raise page count.
>   			 */
> +			page = NULL;
>   			goto out;
>   		}
>   		if (!page_cache_get_speculative(page))
>


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

* Re: [PATCH BUGFIX] mm: fix find_get_page() for shmem exceptional entries
@ 2012-02-07 10:43   ` Konstantin Khlebnikov
  0 siblings, 0 replies; 8+ messages in thread
From: Konstantin Khlebnikov @ 2012-02-07 10:43 UTC (permalink / raw)
  To: linux-mm, Andrew Morton, Hugh Dickins, linux-kernel

Bug was added in commit v3.0-7291-g8079b1c (mm: clarify the radix_tree exceptional cases)
So, v3.1 and v3.2 affected.

Konstantin Khlebnikov wrote:
> It should return NULL, otherwise the caller will be very surprised.
>
> Signed-off-by: Konstantin Khlebnikov<khlebnikov@openvz.org>
> ---
>   mm/filemap.c |    1 +
>   1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 518223b..ca98cb5 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -693,6 +693,7 @@ repeat:
>   			 * here as an exceptional entry: so return it without
>   			 * attempting to raise page count.
>   			 */
> +			page = NULL;
>   			goto out;
>   		}
>   		if (!page_cache_get_speculative(page))
>

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH BUGFIX] mm: fix find_get_page() for shmem exceptional entries
  2012-02-07 10:43   ` Konstantin Khlebnikov
@ 2012-02-07 18:31     ` Hugh Dickins
  -1 siblings, 0 replies; 8+ messages in thread
From: Hugh Dickins @ 2012-02-07 18:31 UTC (permalink / raw)
  To: Konstantin Khlebnikov; +Cc: linux-mm, Andrew Morton, linux-kernel

On Tue, 7 Feb 2012, Konstantin Khlebnikov wrote:

> Bug was added in commit v3.0-7291-g8079b1c (mm: clarify the radix_tree
> exceptional cases)
> So, v3.1 and v3.2 affected.
> 
> Konstantin Khlebnikov wrote:
> > It should return NULL, otherwise the caller will be very surprised.
> > 
> > Signed-off-by: Konstantin Khlebnikov<khlebnikov@openvz.org>

Thanks for worrying about it, but Nak to this patch.

If you have found somewhere that is surprised by an exceptional entry
instead of a page, then indeed we shall need to fix that: I'm not
aware of any.

There are several places that are prepared for the possibility:
find_lock_page() (and your patch would be breaking shmem.c's use of
find_lock_page()), mincore_page(), memcontrol.c's mc_handle_file_pte().

Of the remaining calls to find_get_page(), my understanding is that
either they are filesystems operating upon their own pagecache, or
they involve using ->readpage() - that's one of the two reasons why
I gave shmem its own ->splice_read() and removed its ->readpage()
before switching over to use the exceptional entries.

Hugh

> > ---
> >   mm/filemap.c |    1 +
> >   1 files changed, 1 insertions(+), 0 deletions(-)
> > 
> > diff --git a/mm/filemap.c b/mm/filemap.c
> > index 518223b..ca98cb5 100644
> > --- a/mm/filemap.c
> > +++ b/mm/filemap.c
> > @@ -693,6 +693,7 @@ repeat:
> >   			 * here as an exceptional entry: so return it without
> >   			 * attempting to raise page count.
> >   			 */
> > +			page = NULL;
> >   			goto out;
> >   		}
> >   		if (!page_cache_get_speculative(page))

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

* Re: [PATCH BUGFIX] mm: fix find_get_page() for shmem exceptional entries
@ 2012-02-07 18:31     ` Hugh Dickins
  0 siblings, 0 replies; 8+ messages in thread
From: Hugh Dickins @ 2012-02-07 18:31 UTC (permalink / raw)
  To: Konstantin Khlebnikov; +Cc: linux-mm, Andrew Morton, linux-kernel

On Tue, 7 Feb 2012, Konstantin Khlebnikov wrote:

> Bug was added in commit v3.0-7291-g8079b1c (mm: clarify the radix_tree
> exceptional cases)
> So, v3.1 and v3.2 affected.
> 
> Konstantin Khlebnikov wrote:
> > It should return NULL, otherwise the caller will be very surprised.
> > 
> > Signed-off-by: Konstantin Khlebnikov<khlebnikov@openvz.org>

Thanks for worrying about it, but Nak to this patch.

If you have found somewhere that is surprised by an exceptional entry
instead of a page, then indeed we shall need to fix that: I'm not
aware of any.

There are several places that are prepared for the possibility:
find_lock_page() (and your patch would be breaking shmem.c's use of
find_lock_page()), mincore_page(), memcontrol.c's mc_handle_file_pte().

Of the remaining calls to find_get_page(), my understanding is that
either they are filesystems operating upon their own pagecache, or
they involve using ->readpage() - that's one of the two reasons why
I gave shmem its own ->splice_read() and removed its ->readpage()
before switching over to use the exceptional entries.

Hugh

> > ---
> >   mm/filemap.c |    1 +
> >   1 files changed, 1 insertions(+), 0 deletions(-)
> > 
> > diff --git a/mm/filemap.c b/mm/filemap.c
> > index 518223b..ca98cb5 100644
> > --- a/mm/filemap.c
> > +++ b/mm/filemap.c
> > @@ -693,6 +693,7 @@ repeat:
> >   			 * here as an exceptional entry: so return it without
> >   			 * attempting to raise page count.
> >   			 */
> > +			page = NULL;
> >   			goto out;
> >   		}
> >   		if (!page_cache_get_speculative(page))

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH BUGFIX] mm: fix find_get_page() for shmem exceptional entries
  2012-02-07 18:31     ` Hugh Dickins
@ 2012-02-08  1:41       ` Konstantin Khlebnikov
  -1 siblings, 0 replies; 8+ messages in thread
From: Konstantin Khlebnikov @ 2012-02-08  1:41 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: linux-mm, Andrew Morton, linux-kernel

Hugh Dickins wrote:
> On Tue, 7 Feb 2012, Konstantin Khlebnikov wrote:
>
>> Bug was added in commit v3.0-7291-g8079b1c (mm: clarify the radix_tree
>> exceptional cases)
>> So, v3.1 and v3.2 affected.
>>
>> Konstantin Khlebnikov wrote:
>>> It should return NULL, otherwise the caller will be very surprised.
>>>
>>> Signed-off-by: Konstantin Khlebnikov<khlebnikov@openvz.org>
>
> Thanks for worrying about it, but Nak to this patch.
>
> If you have found somewhere that is surprised by an exceptional entry
> instead of a page, then indeed we shall need to fix that: I'm not
> aware of any.

Oh, this is very dangerous semantics, especially for function called "find-get-page"
which sometimes returns not-getted not-a-page =)

>
> There are several places that are prepared for the possibility:
> find_lock_page() (and your patch would be breaking shmem.c's use of
> find_lock_page()), mincore_page(), memcontrol.c's mc_handle_file_pte().
>
> Of the remaining calls to find_get_page(), my understanding is that
> either they are filesystems operating upon their own pagecache, or
> they involve using ->readpage() - that's one of the two reasons why
> I gave shmem its own ->splice_read() and removed its ->readpage()
> before switching over to use the exceptional entries.
>
> Hugh
>
>>> ---
>>>    mm/filemap.c |    1 +
>>>    1 files changed, 1 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/mm/filemap.c b/mm/filemap.c
>>> index 518223b..ca98cb5 100644
>>> --- a/mm/filemap.c
>>> +++ b/mm/filemap.c
>>> @@ -693,6 +693,7 @@ repeat:
>>>    			 * here as an exceptional entry: so return it without
>>>    			 * attempting to raise page count.
>>>    			 */
>>> +			page = NULL;
>>>    			goto out;
>>>    		}
>>>    		if (!page_cache_get_speculative(page))


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

* Re: [PATCH BUGFIX] mm: fix find_get_page() for shmem exceptional entries
@ 2012-02-08  1:41       ` Konstantin Khlebnikov
  0 siblings, 0 replies; 8+ messages in thread
From: Konstantin Khlebnikov @ 2012-02-08  1:41 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: linux-mm, Andrew Morton, linux-kernel

Hugh Dickins wrote:
> On Tue, 7 Feb 2012, Konstantin Khlebnikov wrote:
>
>> Bug was added in commit v3.0-7291-g8079b1c (mm: clarify the radix_tree
>> exceptional cases)
>> So, v3.1 and v3.2 affected.
>>
>> Konstantin Khlebnikov wrote:
>>> It should return NULL, otherwise the caller will be very surprised.
>>>
>>> Signed-off-by: Konstantin Khlebnikov<khlebnikov@openvz.org>
>
> Thanks for worrying about it, but Nak to this patch.
>
> If you have found somewhere that is surprised by an exceptional entry
> instead of a page, then indeed we shall need to fix that: I'm not
> aware of any.

Oh, this is very dangerous semantics, especially for function called "find-get-page"
which sometimes returns not-getted not-a-page =)

>
> There are several places that are prepared for the possibility:
> find_lock_page() (and your patch would be breaking shmem.c's use of
> find_lock_page()), mincore_page(), memcontrol.c's mc_handle_file_pte().
>
> Of the remaining calls to find_get_page(), my understanding is that
> either they are filesystems operating upon their own pagecache, or
> they involve using ->readpage() - that's one of the two reasons why
> I gave shmem its own ->splice_read() and removed its ->readpage()
> before switching over to use the exceptional entries.
>
> Hugh
>
>>> ---
>>>    mm/filemap.c |    1 +
>>>    1 files changed, 1 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/mm/filemap.c b/mm/filemap.c
>>> index 518223b..ca98cb5 100644
>>> --- a/mm/filemap.c
>>> +++ b/mm/filemap.c
>>> @@ -693,6 +693,7 @@ repeat:
>>>    			 * here as an exceptional entry: so return it without
>>>    			 * attempting to raise page count.
>>>    			 */
>>> +			page = NULL;
>>>    			goto out;
>>>    		}
>>>    		if (!page_cache_get_speculative(page))

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2012-02-08  1:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-07 10:31 [PATCH BUGFIX] mm: fix find_get_page() for shmem exceptional entries Konstantin Khlebnikov
2012-02-07 10:31 ` Konstantin Khlebnikov
2012-02-07 10:43 ` Konstantin Khlebnikov
2012-02-07 10:43   ` Konstantin Khlebnikov
2012-02-07 18:31   ` Hugh Dickins
2012-02-07 18:31     ` Hugh Dickins
2012-02-08  1:41     ` Konstantin Khlebnikov
2012-02-08  1:41       ` Konstantin Khlebnikov

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.