Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756642Ab3CIHKj (ORCPT ); Sat, 9 Mar 2013 02:10:39 -0500 Received: from dcvr.yhbt.net ([64.71.152.64]:34546 "EHLO dcvr.yhbt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754766Ab3CIHKi (ORCPT ); Sat, 9 Mar 2013 02:10:38 -0500 Date: Sat, 9 Mar 2013 07:10:37 +0000 From: Eric Wong To: Arve =?utf-8?B?SGrDuG5uZXbDpWc=?= Cc: NeilBrown , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Davide Libenzi , Alexander Viro , linux-fsdevel@vger.kernel.org, Andrew Morton Subject: Re: epoll: possible bug from wakeup_source activation Message-ID: <20130309071037.GA13360@dcvr.yhbt.net> References: <20130307112639.GA25130@dcvr.yhbt.net> <20130308013027.GA31830@dcvr.yhbt.net> <20130308204944.GA27379@dcvr.yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1142 Lines: 25 Arve Hjønnevåg wrote: > On Fri, Mar 8, 2013 at 12:49 PM, Eric Wong wrote: > > What happens if ep_modify calls ep_destroy_wakeup_source > > while __pm_stay_awake is running on the same epi->ws? > > Yes, that looks like a problem. I think calling > ep_destroy_wakeup_source with ep->lock held should fix that. It is not > clear how useful changing EPOLLWAKEUP in ep_modify is, so > alternatively we could remove that feature and instead only allow it > to be set in ep_insert. ep->lock would work, but ep->lock is already a source of heavy contention in my multithreaded+epoll webservers. Perhaps RCU can be used? I've no experience with RCU, but I've been meaning to get acquainted with RCU. Another possible solution is to only use ep->ws and add an atomic counter to ep; so __pm_relax(ep->ws) is only called when the atomic counter reaches zero. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/