Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-29 Thread Dan Williams
On Mon, Jul 29, 2019 at 5:02 AM Jan Kara wrote: > > On Tue 16-07-19 20:39:46, Dan Williams wrote: > > On Fri, Jul 12, 2019 at 2:14 AM Jan Kara wrote: > > > > > > On Thu 11-07-19 08:25:50, Matthew Wilcox wrote: > > > > On Thu, Jul 11, 2019 at 07:13:50AM -0700, Matthew Wilcox wrote: > > > > >

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-29 Thread Jan Kara
On Tue 16-07-19 20:39:46, Dan Williams wrote: > On Fri, Jul 12, 2019 at 2:14 AM Jan Kara wrote: > > > > On Thu 11-07-19 08:25:50, Matthew Wilcox wrote: > > > On Thu, Jul 11, 2019 at 07:13:50AM -0700, Matthew Wilcox wrote: > > > > However, the XA_RETRY_ENTRY might be a good choice. It doesn't

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-16 Thread Dan Williams
On Fri, Jul 12, 2019 at 2:14 AM Jan Kara wrote: > > On Thu 11-07-19 08:25:50, Matthew Wilcox wrote: > > On Thu, Jul 11, 2019 at 07:13:50AM -0700, Matthew Wilcox wrote: > > > However, the XA_RETRY_ENTRY might be a good choice. It doesn't normally > > > appear in an XArray (it may appear if you're

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-12 Thread Jan Kara
On Thu 11-07-19 08:25:50, Matthew Wilcox wrote: > On Thu, Jul 11, 2019 at 07:13:50AM -0700, Matthew Wilcox wrote: > > However, the XA_RETRY_ENTRY might be a good choice. It doesn't normally > > appear in an XArray (it may appear if you're looking at a deleted node, > > but since we're holding the

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-11 Thread Matthew Wilcox
On Thu, Jul 11, 2019 at 07:13:50AM -0700, Matthew Wilcox wrote: > However, the XA_RETRY_ENTRY might be a good choice. It doesn't normally > appear in an XArray (it may appear if you're looking at a deleted node, > but since we're holding the lock, we can't see deleted nodes). Updated patch (also

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-11 Thread Matthew Wilcox
On Wed, Jul 10, 2019 at 10:26:47PM +0200, Jan Kara wrote: > On Wed 10-07-19 13:15:39, Matthew Wilcox wrote: > > On Wed, Jul 10, 2019 at 09:02:04PM +0200, Jan Kara wrote: > > > +#define DAX_ENTRY_CONFLICT dax_make_entry(pfn_to_pfn_t(1), DAX_EMPTY) > > > > I was hoping to get rid of DAX_EMPTY ...

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-11 Thread Matthew Wilcox
On Thu, Jul 11, 2019 at 09:48:59AM +0200, Jan Kara wrote: > On Wed 10-07-19 20:08:55, Matthew Wilcox wrote: > > On Wed, Jul 10, 2019 at 09:02:04PM +0200, Jan Kara wrote: > > > @@ -848,7 +853,7 @@ static int dax_writeback_one(struct xa_state *xas, > > > struct dax_device *dax_dev, > > > if

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-11 Thread Jan Kara
On Wed 10-07-19 13:15:39, Matthew Wilcox wrote: > On Wed, Jul 10, 2019 at 09:02:04PM +0200, Jan Kara wrote: > > +#define DAX_ENTRY_CONFLICT dax_make_entry(pfn_to_pfn_t(1), DAX_EMPTY) > > I was hoping to get rid of DAX_EMPTY ... it's almost unused now. Once > we switch to having a single DAX_LOCK

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-11 Thread Jan Kara
On Wed 10-07-19 20:35:55, Matthew Wilcox wrote: > On Wed, Jul 10, 2019 at 09:02:04PM +0200, Jan Kara wrote: > > So how about the attached patch? That keeps the interface sane and passes a > > smoketest for me (full fstest run running). Obviously it also needs a > > proper changelog... > >

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-11 Thread Jan Kara
On Wed 10-07-19 20:08:55, Matthew Wilcox wrote: > On Wed, Jul 10, 2019 at 09:02:04PM +0200, Jan Kara wrote: > > @@ -848,7 +853,7 @@ static int dax_writeback_one(struct xa_state *xas, > > struct dax_device *dax_dev, > > if (unlikely(dax_is_locked(entry))) { > > void *old_entry =

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-10 Thread Matthew Wilcox
On Wed, Jul 10, 2019 at 09:02:04PM +0200, Jan Kara wrote: > So how about the attached patch? That keeps the interface sane and passes a > smoketest for me (full fstest run running). Obviously it also needs a > proper changelog... Changelog and slightly massaged version along the lines of my two

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-10 Thread Matthew Wilcox
On Wed, Jul 10, 2019 at 09:02:04PM +0200, Jan Kara wrote: > @@ -848,7 +853,7 @@ static int dax_writeback_one(struct xa_state *xas, struct > dax_device *dax_dev, > if (unlikely(dax_is_locked(entry))) { > void *old_entry = entry; > > - entry =

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-10 Thread Matthew Wilcox
On Wed, Jul 10, 2019 at 09:02:04PM +0200, Jan Kara wrote: > +#define DAX_ENTRY_CONFLICT dax_make_entry(pfn_to_pfn_t(1), DAX_EMPTY) I was hoping to get rid of DAX_EMPTY ... it's almost unused now. Once we switch to having a single DAX_LOCK value instead of a single bit, I think it can go away,

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-10 Thread Jan Kara
named? You'd rather it was called "try_get_unlocked_entry()"? > > I was thinking more along the lines of > get_unlocked_but_sometimes_locked_entry(), i.e. per Jan's feedback to > keep the interface simple. So how about the attached patch? That keeps the interface sane an

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-05 Thread Matthew Wilcox
On Thu, Jul 04, 2019 at 04:27:14PM -0700, Dan Williams wrote: > On Thu, Jul 4, 2019 at 12:14 PM Matthew Wilcox wrote: > > > > On Thu, Jul 04, 2019 at 06:54:50PM +0200, Jan Kara wrote: > > > On Wed 03-07-19 20:27:28, Matthew Wilcox wrote: > > > > So I think we're good for all current users. > > >

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-04 Thread Dan Williams
On Thu, Jul 4, 2019 at 12:14 PM Matthew Wilcox wrote: > > On Thu, Jul 04, 2019 at 06:54:50PM +0200, Jan Kara wrote: > > On Wed 03-07-19 20:27:28, Matthew Wilcox wrote: > > > So I think we're good for all current users. > > > > Agreed but it is an ugly trap. As I already said, I'd rather pay the >

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-04 Thread Matthew Wilcox
On Thu, Jul 04, 2019 at 06:54:50PM +0200, Jan Kara wrote: > On Wed 03-07-19 20:27:28, Matthew Wilcox wrote: > > So I think we're good for all current users. > > Agreed but it is an ugly trap. As I already said, I'd rather pay the > unnecessary cost of waiting for pte entry and have an easy to

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-04 Thread Jan Kara
On Wed 03-07-19 20:27:28, Matthew Wilcox wrote: > On Wed, Jul 03, 2019 at 02:28:41PM -0700, Dan Williams wrote: > > On Wed, Jul 3, 2019 at 12:53 PM Matthew Wilcox wrote: > > > @@ -211,7 +215,8 @@ static void *get_unlocked_entry(struct xa_state *xas) > > > for (;;) { > > >

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-04 Thread Boaz Harrosh
On 04/07/2019 16:58, Matthew Wilcox wrote: > On Thu, Jul 04, 2019 at 04:00:00PM +0300, Boaz Harrosh wrote: <> >> Matthew you must be kidding an ilog2 in binary is zero clocks >> (Return the highest bit or something like that) > > You might want to actually check the documentation instead of just

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-04 Thread Matthew Wilcox
On Thu, Jul 04, 2019 at 04:00:00PM +0300, Boaz Harrosh wrote: > On 04/07/2019 06:27, Matthew Wilcox wrote: > > On Wed, Jul 03, 2019 at 02:28:41PM -0700, Dan Williams wrote: > >>> +#ifdef CONFIG_XARRAY_MULTI > >>> + unsigned int sibs = xas->xa_sibs; > >>> + > >>> + while (sibs) { > >>>

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-04 Thread Boaz Harrosh
On 04/07/2019 06:27, Matthew Wilcox wrote: > On Wed, Jul 03, 2019 at 02:28:41PM -0700, Dan Williams wrote: <> >>> +#ifdef CONFIG_XARRAY_MULTI >>> + unsigned int sibs = xas->xa_sibs; >>> + >>> + while (sibs) { >>> + order++; >>> + sibs /= 2; >>> + } >>

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-03 Thread Matthew Wilcox
On Wed, Jul 03, 2019 at 02:28:41PM -0700, Dan Williams wrote: > On Wed, Jul 3, 2019 at 12:53 PM Matthew Wilcox wrote: > > @@ -211,7 +215,8 @@ static void *get_unlocked_entry(struct xa_state *xas) > > for (;;) { > > entry = xas_find_conflict(xas); > > if

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-03 Thread Dan Williams
On Wed, Jul 3, 2019 at 12:53 PM Matthew Wilcox wrote: > > On Wed, Jul 03, 2019 at 10:01:37AM -0700, Dan Williams wrote: > > On Wed, Jul 3, 2019 at 5:17 AM Matthew Wilcox wrote: > > > > > > On Wed, Jul 03, 2019 at 12:24:54AM -0700, Dan Williams wrote: > > > > This fix may increase waitqueue

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-03 Thread Matthew Wilcox
On Wed, Jul 03, 2019 at 10:01:37AM -0700, Dan Williams wrote: > On Wed, Jul 3, 2019 at 5:17 AM Matthew Wilcox wrote: > > > > On Wed, Jul 03, 2019 at 12:24:54AM -0700, Dan Williams wrote: > > > This fix may increase waitqueue contention, but a fix for that is saved > > > for a larger rework. In

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-03 Thread Dan Williams
On Wed, Jul 3, 2019 at 5:17 AM Matthew Wilcox wrote: > > On Wed, Jul 03, 2019 at 12:24:54AM -0700, Dan Williams wrote: > > This fix may increase waitqueue contention, but a fix for that is saved > > for a larger rework. In the meantime this fix is suitable for -stable > > backports. > > I think

Re: [PATCH] dax: Fix missed PMD wakeups

2019-07-03 Thread Matthew Wilcox
On Wed, Jul 03, 2019 at 12:24:54AM -0700, Dan Williams wrote: > This fix may increase waitqueue contention, but a fix for that is saved > for a larger rework. In the meantime this fix is suitable for -stable > backports. I think this is too big for what it is; just the two-line patch to stop

[PATCH] dax: Fix missed PMD wakeups

2019-07-03 Thread Dan Williams
Ever since the conversion of DAX to the Xarray a RocksDB benchmark has been encountering intermittent lockups. In the failing case a thread that is taking a PMD-fault is awaiting a wakeup while holding the 'mmap_sem' for read. As soon as the next mmap() event occurs that tries to take the