linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: Drop setting redundant PF_KSWAPD in kswapd context
@ 2017-08-24 10:42 Anshuman Khandual
  2017-08-24 10:56 ` Michal Hocko
  0 siblings, 1 reply; 4+ messages in thread
From: Anshuman Khandual @ 2017-08-24 10:42 UTC (permalink / raw)
  To: linux-mm, linux-xfs, linux-kernel; +Cc: dchinner, bfoster, sandeen

xfs_btree_split() calls xfs_btree_split_worker() with args.kswapd set
if current->flags alrady has PF_KSWAPD. Hence we should not again add
PF_KSWAPD into the current flags inside kswapd context. So drop this
redundant flag addition.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
 fs/xfs/libxfs/xfs_btree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index e0bcc4a..b3c85e3 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -2895,7 +2895,7 @@ struct xfs_btree_split_args {
 	 * in any way.
 	 */
 	if (args->kswapd)
-		new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD;
+		new_pflags |= PF_MEMALLOC | PF_SWAPWRITE;
 
 	current_set_flags_nested(&pflags, new_pflags);
 
-- 
1.8.5.2


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

* Re: [PATCH] xfs: Drop setting redundant PF_KSWAPD in kswapd context
  2017-08-24 10:42 [PATCH] xfs: Drop setting redundant PF_KSWAPD in kswapd context Anshuman Khandual
@ 2017-08-24 10:56 ` Michal Hocko
  2017-08-25  0:01   ` Dave Chinner
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Hocko @ 2017-08-24 10:56 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, linux-xfs, linux-kernel, dchinner, bfoster, sandeen

On Thu 24-08-17 16:12:47, Anshuman Khandual wrote:
> xfs_btree_split() calls xfs_btree_split_worker() with args.kswapd set
> if current->flags alrady has PF_KSWAPD. Hence we should not again add
> PF_KSWAPD into the current flags inside kswapd context. So drop this
> redundant flag addition.

I am not familiar with the code but your change seems incorect. The
whole point of args->kswapd is to convey the kswapd context to the
worker which is obviously running in a different context. So this patch
loses the kswapd context.

> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
> ---
>  fs/xfs/libxfs/xfs_btree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
> index e0bcc4a..b3c85e3 100644
> --- a/fs/xfs/libxfs/xfs_btree.c
> +++ b/fs/xfs/libxfs/xfs_btree.c
> @@ -2895,7 +2895,7 @@ struct xfs_btree_split_args {
>  	 * in any way.
>  	 */
>  	if (args->kswapd)
> -		new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD;
> +		new_pflags |= PF_MEMALLOC | PF_SWAPWRITE;
>  
>  	current_set_flags_nested(&pflags, new_pflags);
>  
> -- 
> 1.8.5.2

-- 
Michal Hocko
SUSE Labs

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

* Re: [PATCH] xfs: Drop setting redundant PF_KSWAPD in kswapd context
  2017-08-24 10:56 ` Michal Hocko
@ 2017-08-25  0:01   ` Dave Chinner
  2017-08-25  4:02     ` Anshuman Khandual
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Chinner @ 2017-08-25  0:01 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Anshuman Khandual, linux-mm, linux-xfs, linux-kernel, dchinner,
	bfoster, sandeen

On Thu, Aug 24, 2017 at 12:56:35PM +0200, Michal Hocko wrote:
> On Thu 24-08-17 16:12:47, Anshuman Khandual wrote:
> > xfs_btree_split() calls xfs_btree_split_worker() with args.kswapd set
> > if current->flags alrady has PF_KSWAPD. Hence we should not again add
> > PF_KSWAPD into the current flags inside kswapd context. So drop this
> > redundant flag addition.
> 
> I am not familiar with the code but your change seems incorect. The
> whole point of args->kswapd is to convey the kswapd context to the
> worker which is obviously running in a different context. So this patch
> loses the kswapd context.

Yup. That's what the code does, and removing the PF_KSWAPD from it
will break it.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH] xfs: Drop setting redundant PF_KSWAPD in kswapd context
  2017-08-25  0:01   ` Dave Chinner
@ 2017-08-25  4:02     ` Anshuman Khandual
  0 siblings, 0 replies; 4+ messages in thread
From: Anshuman Khandual @ 2017-08-25  4:02 UTC (permalink / raw)
  To: Dave Chinner, Michal Hocko
  Cc: Anshuman Khandual, linux-mm, linux-xfs, linux-kernel, dchinner,
	bfoster, sandeen

On 08/25/2017 05:31 AM, Dave Chinner wrote:
> On Thu, Aug 24, 2017 at 12:56:35PM +0200, Michal Hocko wrote:
>> On Thu 24-08-17 16:12:47, Anshuman Khandual wrote:
>>> xfs_btree_split() calls xfs_btree_split_worker() with args.kswapd set
>>> if current->flags alrady has PF_KSWAPD. Hence we should not again add
>>> PF_KSWAPD into the current flags inside kswapd context. So drop this
>>> redundant flag addition.
>>
>> I am not familiar with the code but your change seems incorect. The
>> whole point of args->kswapd is to convey the kswapd context to the
>> worker which is obviously running in a different context. So this patch
>> loses the kswapd context.
> 
> Yup. That's what the code does, and removing the PF_KSWAPD from it
> will break it.

The worker thread need to inherit these flags. Thanks for pointing out.


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

end of thread, other threads:[~2017-08-25  4:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-24 10:42 [PATCH] xfs: Drop setting redundant PF_KSWAPD in kswapd context Anshuman Khandual
2017-08-24 10:56 ` Michal Hocko
2017-08-25  0:01   ` Dave Chinner
2017-08-25  4:02     ` Anshuman Khandual

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).