Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-18 Thread Minchan Kim
On Thu, Feb 18, 2021 at 05:08:58PM +0100, Michal Hocko wrote: > On Thu 18-02-21 07:52:25, Minchan Kim wrote: > > On Thu, Feb 18, 2021 at 09:17:02AM +0100, Michal Hocko wrote: > > > On Wed 17-02-21 13:32:05, Minchan Kim wrote: > > > > On Wed, Feb 17, 2021 at 09:16:12PM +, Matthew Wilcox wrote: >

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-18 Thread Michal Hocko
On Thu 18-02-21 07:52:25, Minchan Kim wrote: > On Thu, Feb 18, 2021 at 09:17:02AM +0100, Michal Hocko wrote: > > On Wed 17-02-21 13:32:05, Minchan Kim wrote: > > > On Wed, Feb 17, 2021 at 09:16:12PM +, Matthew Wilcox wrote: > > > > On Wed, Feb 17, 2021 at 12:46:19PM -0800, Minchan Kim wrote: >

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-18 Thread Minchan Kim
On Thu, Feb 18, 2021 at 09:17:02AM +0100, Michal Hocko wrote: > On Wed 17-02-21 13:32:05, Minchan Kim wrote: > > On Wed, Feb 17, 2021 at 09:16:12PM +, Matthew Wilcox wrote: > > > On Wed, Feb 17, 2021 at 12:46:19PM -0800, Minchan Kim wrote: > > > > > I suspect you do not want to add atomic_read

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-18 Thread David Hildenbrand
On 18.02.21 09:17, Michal Hocko wrote: On Wed 17-02-21 13:32:05, Minchan Kim wrote: On Wed, Feb 17, 2021 at 09:16:12PM +, Matthew Wilcox wrote: On Wed, Feb 17, 2021 at 12:46:19PM -0800, Minchan Kim wrote: I suspect you do not want to add atomic_read inside hot paths, right? Is this really

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-18 Thread Michal Hocko
On Wed 17-02-21 13:32:05, Minchan Kim wrote: > On Wed, Feb 17, 2021 at 09:16:12PM +, Matthew Wilcox wrote: > > On Wed, Feb 17, 2021 at 12:46:19PM -0800, Minchan Kim wrote: > > > > I suspect you do not want to add atomic_read inside hot paths, right? Is > > > > this really something that we have

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-17 Thread Minchan Kim
On Wed, Feb 17, 2021 at 09:16:12PM +, Matthew Wilcox wrote: > On Wed, Feb 17, 2021 at 12:46:19PM -0800, Minchan Kim wrote: > > > I suspect you do not want to add atomic_read inside hot paths, right? Is > > > this really something that we have to microoptimize for? atomic_read is > > > a simple

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-17 Thread Minchan Kim
On Wed, Feb 17, 2021 at 09:11:43PM +, Matthew Wilcox wrote: > On Wed, Feb 17, 2021 at 12:51:25PM -0800, Minchan Kim wrote: > > I'd like to avoid atomic operation if we could. > > Why do you think that the spinlock is better? > Michal suggested atomic_inc in writeside and atomic_read in reads

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-17 Thread Matthew Wilcox
On Wed, Feb 17, 2021 at 12:46:19PM -0800, Minchan Kim wrote: > > I suspect you do not want to add atomic_read inside hot paths, right? Is > > this really something that we have to microoptimize for? atomic_read is > > a simple READ_ONCE on many archs. > > It's also spin_lock_irq_save in some arch.

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-17 Thread Matthew Wilcox
On Wed, Feb 17, 2021 at 12:51:25PM -0800, Minchan Kim wrote: > I'd like to avoid atomic operation if we could. Why do you think that the spinlock is better?

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-17 Thread Minchan Kim
On Wed, Feb 17, 2021 at 10:50:55AM +0100, Michal Hocko wrote: > On Wed 17-02-21 09:59:54, Michal Hocko wrote: > > On Tue 16-02-21 09:03:47, Minchan Kim wrote: > [...] > > > /* > > > * migrate_prep() needs to be called before we start compiling a list of > > > pages > > > * to be migrated usin

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-17 Thread Minchan Kim
On Wed, Feb 17, 2021 at 09:59:54AM +0100, Michal Hocko wrote: > On Tue 16-02-21 09:03:47, Minchan Kim wrote: > > LRU pagevec holds refcount of pages until the pagevec are drained. > > It could prevent migration since the refcount of the page is greater > > than the expection in migration logic. To

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-17 Thread Michal Hocko
On Wed 17-02-21 09:59:54, Michal Hocko wrote: > On Tue 16-02-21 09:03:47, Minchan Kim wrote: [...] > > /* > > * migrate_prep() needs to be called before we start compiling a list of > > pages > > * to be migrated using isolate_lru_page(). If scheduling work on other > > CPUs is > > @@ -64,11

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-17 Thread Michal Hocko
On Tue 16-02-21 09:03:47, Minchan Kim wrote: > LRU pagevec holds refcount of pages until the pagevec are drained. > It could prevent migration since the refcount of the page is greater > than the expection in migration logic. To mitigate the issue, > callers of migrate_pages drains LRU pagevec via

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-16 Thread Minchan Kim
On Tue, Feb 16, 2021 at 06:22:42PM +, Matthew Wilcox wrote: > On Tue, Feb 16, 2021 at 09:03:47AM -0800, Minchan Kim wrote: > > LRU pagevec holds refcount of pages until the pagevec are drained. > > It could prevent migration since the refcount of the page is greater > > than the expection in mi

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-16 Thread Matthew Wilcox
On Tue, Feb 16, 2021 at 09:03:47AM -0800, Minchan Kim wrote: > LRU pagevec holds refcount of pages until the pagevec are drained. > It could prevent migration since the refcount of the page is greater > than the expection in migration logic. To mitigate the issue, > callers of migrate_pages drains

[RFC 1/2] mm: disable LRU pagevec during the migration temporarily

2021-02-16 Thread Minchan Kim
LRU pagevec holds refcount of pages until the pagevec are drained. It could prevent migration since the refcount of the page is greater than the expection in migration logic. To mitigate the issue, callers of migrate_pages drains LRU pagevec via migrate_prep or lru_add_drain_all before migrate_page