On Fri 15-02-19 15:08:36, Huang, Ying wrote:
> Michal Hocko writes:
>
> > On Mon 11-02-19 16:38:46, Huang, Ying wrote:
> >> From: Huang Ying
> >>
> >> When swapin is performed, after getting the swap entry information from
> >> the page table, system will swap in the swap entry, without any loc
Andrea Arcangeli writes:
> On Thu, Feb 14, 2019 at 04:07:37PM +0800, Huang, Ying wrote:
>> Before, we choose to use stop_machine() to reduce the overhead of hot
>> path (page fault handler) as much as possible. But now, I found
>> rcu_read_lock_sched() is just a wrapper of preempt_disable(). So
On Thu, Feb 14, 2019 at 04:07:37PM +0800, Huang, Ying wrote:
> Before, we choose to use stop_machine() to reduce the overhead of hot
> path (page fault handler) as much as possible. But now, I found
> rcu_read_lock_sched() is just a wrapper of preempt_disable(). So maybe
> we can switch to RCU ve
Hello,
On Thu, Feb 14, 2019 at 12:30:02PM -0800, Andrew Morton wrote:
> This was discussed to death and I think the changelog explains the
> conclusions adequately. swapoff is super-rare so a stop_machine() in
> that path is appropriate if its use permits more efficiency in the
> regular swap cod
On Thu, 14 Feb 2019 15:33:18 +0100 Michal Hocko wrote:
> > Because swapoff() is very rare code path, to make the normal path runs as
> > fast as possible, disabling preemption + stop_machine() instead of
> > reference count is used to implement get/put_swap_device(). From
> > get_swap_device() t
On Mon 11-02-19 16:38:46, Huang, Ying wrote:
> From: Huang Ying
>
> When swapin is performed, after getting the swap entry information from
> the page table, system will swap in the swap entry, without any lock held
> to prevent the swap device from being swapoff. This may cause the race
> like
Hello everyone,
On Mon, Feb 11, 2019 at 04:38:46PM +0800, Huang, Ying wrote:
> @@ -2386,7 +2463,17 @@ static void enable_swap_info(struct swap_info_struct
> *p, int prio,
> frontswap_init(p->type, frontswap_map);
> spin_lock(&swap_lock);
> spin_lock(&p->lock);
> - _enable_s
Tim Chen writes:
> On 2/11/19 10:47 PM, Huang, Ying wrote:
>> Andrea Parri writes:
>>
> + if (!si)
> + goto bad_nofile;
> +
> + preempt_disable();
> + if (!(si->flags & SWP_VALID))
> + goto unlock_out;
After Hugh alluded to barriers, it seems th
On Tue, Feb 12, 2019 at 04:21:21AM +0100, Andrea Parri wrote:
> > > + if (!si)
> > > + goto bad_nofile;
> > > +
> > > + preempt_disable();
> > > + if (!(si->flags & SWP_VALID))
> > > + goto unlock_out;
> >
> > After Hugh alluded to barriers, it seems the read of SWP_VALID could be
On 2/11/19 10:47 PM, Huang, Ying wrote:
> Andrea Parri writes:
>
+ if (!si)
+ goto bad_nofile;
+
+ preempt_disable();
+ if (!(si->flags & SWP_VALID))
+ goto unlock_out;
>>>
>>> After Hugh alluded to barriers, it seems the read of SWP_VALID could
> Alternative implementation could be replacing disable preemption with
> rcu_read_lock_sched and stop_machine() with synchronize_sched().
JFYI, starting with v4.20-rc1, synchronize_rcu{,expedited}() also wait
for preempt-disable sections (the intent seems to retire the RCU-sched
update-side API),
Daniel Jordan writes:
> On Mon, Feb 11, 2019 at 04:38:46PM +0800, Huang, Ying wrote:
>> +struct swap_info_struct *get_swap_device(swp_entry_t entry)
>> +{
>> +struct swap_info_struct *si;
>> +unsigned long type, offset;
>> +
>> +if (!entry.val)
>> +goto out;
>
>> +type
> > + if (!si)
> > + goto bad_nofile;
> > +
> > + preempt_disable();
> > + if (!(si->flags & SWP_VALID))
> > + goto unlock_out;
>
> After Hugh alluded to barriers, it seems the read of SWP_VALID could be
> reordered with the write in preempt_disable at runtime. Without s
On Mon, Feb 11, 2019 at 04:38:46PM +0800, Huang, Ying wrote:
> +struct swap_info_struct *get_swap_device(swp_entry_t entry)
> +{
> + struct swap_info_struct *si;
> + unsigned long type, offset;
> +
> + if (!entry.val)
> + goto out;
> + type = swp_type(entry);
> + si
From: Huang Ying
When swapin is performed, after getting the swap entry information from
the page table, system will swap in the swap entry, without any lock held
to prevent the swap device from being swapoff. This may cause the race
like below,
CPU 1 CPU 2
-
15 matches
Mail list logo