From mboxrd@z Thu Jan 1 00:00:00 1970 From: Evgeniy Polyakov Subject: Re: [take3 1/4] kevent: Core files. Date: Thu, 3 Aug 2006 18:55:57 +0400 Message-ID: <20060803145553.GA12915@2ka.mipt.ru> References: <11545983603399@2ka.mipt.ru> <200608031640.34513.dada1@cosmosbay.com> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Cc: lkml , David Miller , Ulrich Drepper , netdev , Zach Brown Return-path: Received: from relay.2ka.mipt.ru ([194.85.82.65]:33153 "EHLO 2ka.mipt.ru") by vger.kernel.org with ESMTP id S932553AbWHCO5B (ORCPT ); Thu, 3 Aug 2006 10:57:01 -0400 To: Eric Dumazet Content-Disposition: inline In-Reply-To: <200608031640.34513.dada1@cosmosbay.com> Sender: netdev-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Thu, Aug 03, 2006 at 04:40:34PM +0200, Eric Dumazet (dada1@cosmosbay.com) wrote: > > + mutex_lock(&u->ctl_mutex); > > + while (num < max_nr && ((k = kqueue_dequeue_ready(u)) != NULL)) { > > + if (copy_to_user(buf + num*sizeof(struct ukevent), > > + &k->event, sizeof(struct ukevent))) { > > + cerr = -EINVAL; > > + break; > > + } > > > It seems quite wrong to hold ctl_mutex while doing a copy_to_user() (of > possibly a large amount of data) : A thread can sleep on a page fault and > other threads cannot make progress. I would not call that wrong - system prevents some threads from removing kevents which are counted to be transfered to the userspace, i.e. when dequeuing was awakened and it had seen some events it is possible, that when it will dequeue them part will be removed by other thread, so I prevent this. > Eric -- Evgeniy Polyakov