Re: [RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-19 Thread Tim Chen
On 12/19/18 3:48 PM, Yang Shi wrote: > > > On 12/19/18 11:00 AM, Tim Chen wrote: >> On 12/19/18 10:40 AM, Yang Shi wrote: >>> >> I don't think your dereference inode = si->swap_file->f_mapping->host >> is always safe.  You should do it only when (si->flags & SWP_FS) is true. > Do you

Re: [RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-19 Thread Yang Shi
On 12/19/18 11:00 AM, Tim Chen wrote: On 12/19/18 10:40 AM, Yang Shi wrote: I don't think your dereference inode = si->swap_file->f_mapping->host is always safe.  You should do it only when (si->flags & SWP_FS) is true. Do you mean it is not safe for swap partition? The f_mapping may not

Re: [RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-19 Thread Tim Chen
On 12/19/18 10:40 AM, Yang Shi wrote: > > I don't think your dereference inode = si->swap_file->f_mapping->host is always safe.  You should do it only when (si->flags & SWP_FS) is true. >>> Do you mean it is not safe for swap partition? >> The f_mapping may not be instantiated.  It is

Re: [RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-19 Thread Yang Shi
On 12/19/18 9:28 AM, Tim Chen wrote: On 12/18/18 9:56 PM, Yang Shi wrote: On 12/18/18 4:16 PM, Tim Chen wrote: On 12/18/18 3:43 PM, Yang Shi wrote: On 12/18/18 11:29 AM, Tim Chen wrote: On 12/17/18 10:52 PM, Yang Shi wrote: diff --git a/mm/swap_state.c b/mm/swap_state.c index fd2f21e..7

Re: [RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-19 Thread Tim Chen
On 12/18/18 9:56 PM, Yang Shi wrote: > > > On 12/18/18 4:16 PM, Tim Chen wrote: >> On 12/18/18 3:43 PM, Yang Shi wrote: >>> >>> On 12/18/18 11:29 AM, Tim Chen wrote: On 12/17/18 10:52 PM, Yang Shi wrote: > diff --git a/mm/swap_state.c b/mm/swap_state.c > index fd2f21e..7cc3c29 1

Re: [RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-18 Thread Yang Shi
On 12/18/18 4:16 PM, Tim Chen wrote: On 12/18/18 3:43 PM, Yang Shi wrote: On 12/18/18 11:29 AM, Tim Chen wrote: On 12/17/18 10:52 PM, Yang Shi wrote: diff --git a/mm/swap_state.c b/mm/swap_state.c index fd2f21e..7cc3c29 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -538,11 +538,15

Re: [RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-18 Thread Tim Chen
On 12/18/18 3:43 PM, Yang Shi wrote: > > > On 12/18/18 11:29 AM, Tim Chen wrote: >> On 12/17/18 10:52 PM, Yang Shi wrote: >> >>> diff --git a/mm/swap_state.c b/mm/swap_state.c >>> index fd2f21e..7cc3c29 100644 >>> --- a/mm/swap_state.c >>> +++ b/mm/swap_state.c >>> @@ -538,11 +538,15 @@ struct pa

Re: [RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-18 Thread Yang Shi
On 12/18/18 11:29 AM, Tim Chen wrote: On 12/17/18 10:52 PM, Yang Shi wrote: diff --git a/mm/swap_state.c b/mm/swap_state.c index fd2f21e..7cc3c29 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -538,11 +538,15 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask,

Re: [RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-18 Thread Tim Chen
On 12/17/18 10:52 PM, Yang Shi wrote: > > diff --git a/mm/swap_state.c b/mm/swap_state.c > index fd2f21e..7cc3c29 100644 > --- a/mm/swap_state.c > +++ b/mm/swap_state.c > @@ -538,11 +538,15 @@ struct page *swap_cluster_readahead(swp_entry_t entry, > gfp_t gfp_mask, > bool do_poll = true, p

[RFC PATCH 1/2] mm: swap: check if swap backing device is congested or not

2018-12-17 Thread Yang Shi
Swap readahead would read in a few pages regardless if the underlying device is busy or not. It may incur long waiting time if the device is congested, and it may also exacerbate the congestion. Use inode_read_congested() to check if the underlying device is busy or not like what file page readah