From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757277AbZINVrX (ORCPT ); Mon, 14 Sep 2009 17:47:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757121AbZINVrV (ORCPT ); Mon, 14 Sep 2009 17:47:21 -0400 Received: from mail8.sea5.speakeasy.net ([69.17.117.10]:44837 "EHLO mail8.sea5.speakeasy.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756977AbZINVrU (ORCPT ); Mon, 14 Sep 2009 17:47:20 -0400 Date: Mon, 14 Sep 2009 14:47:22 -0700 (PDT) From: Trent Piepho X-X-Sender: xyzzy@shell2.speakeasy.net To: Andreas Mohr cc: Guennadi Liakhovetski , Mauro Carvalho Chehab , Luca Risolia , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: V4L2 drivers: potentially dangerous and inefficient msecs_to_jiffies() calculation In-Reply-To: <20090914210741.GA16799@rhlx01.hs-esslingen.de> Message-ID: References: <20090914210741.GA16799@rhlx01.hs-esslingen.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 14 Sep 2009, Andreas Mohr wrote: > cam->module_param.frame_timeout * > 1000 * msecs_to_jiffies(1) ); > multiple times each. > What they should do instead is > frame_timeout * msecs_to_jiffies(1000), I'd think. > msecs_to_jiffies(1) is quite a bit too boldly assuming > that all of the msecs_to_jiffies(x) implementation branches > always round up. It might also wait far longer than desired. On a 100 Hz kernel a jiffie is 10 ms. 1000 * msecs_to_jiffies(1) will wait 10 seconds instead of 1. But, I believe there is an issue with msecs_to_jiffies(x) overflowing for very high values of x. I'm not sure where that point is though.