From patchwork Thu Jan 3 13:41:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 209252 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 996242C0084 for ; Fri, 4 Jan 2013 00:41:16 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753503Ab3ACNlO (ORCPT ); Thu, 3 Jan 2013 08:41:14 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:51704 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753271Ab3ACNlM (ORCPT ); Thu, 3 Jan 2013 08:41:12 -0500 Received: by mail-pa0-f47.google.com with SMTP id fa10so8626296pad.34 for ; Thu, 03 Jan 2013 05:41:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:subject:from:to:cc:in-reply-to:references:content-type :date:message-id:mime-version:x-mailer:content-transfer-encoding; bh=+DKUvZOXynJc39+9BBL5ckbneWRmfeVYGY+z36CZqEo=; b=XrjJ12vDy+9PTjqPP3hBrMVXCaLMoabNRs/MzbDsxGQScgkwYk9DzQskpi/hTMh0mJ OYhlkOE14/o862sD8rkS9RlakP0hJ1YRY+w1xBrrIC8lHfkNnyqJKuzKIpbeiP3nZ/+X qr7OKuVOG5ghg9pgohpYd8FM3DPt6lx9CmPGVwpR7fy0jTng3vHit7I0wfcJkFeqtiyE GxRiVAgRp6BQm39wSmom5DYiw8DpVnSdBR5UWF9/t1hAGkpYdB1mwzRWkxR6rc/AXvC/ 2rjtIeanJKXktcKt83zbU0McpE3uxh0aNuH3Hw7rxCw7pVsmuN72zeNwy5zLpU3A0B/w HljQ== X-Received: by 10.68.197.9 with SMTP id iq9mr151594777pbc.130.1357220472029; Thu, 03 Jan 2013 05:41:12 -0800 (PST) Received: from [172.26.54.205] ([172.26.54.205]) by mx.google.com with ESMTPS id oz9sm30349634pbb.68.2013.01.03.05.41.10 (version=SSLv3 cipher=OTHER); Thu, 03 Jan 2013 05:41:10 -0800 (PST) Subject: Re: ppoll() stuck on POLLIN while TCP peer is sending From: Eric Dumazet To: Eric Wong Cc: Mel Gorman , linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Rik van Riel , Minchan Kim , Andrew Morton , Linus Torvalds In-Reply-To: <20130102204712.GA17806@dcvr.yhbt.net> References: <20121228014503.GA5017@dcvr.yhbt.net> <20130102200848.GA4500@dcvr.yhbt.net> <20130102204712.GA17806@dcvr.yhbt.net> Date: Thu, 03 Jan 2013 05:41:09 -0800 Message-ID: <1357220469.21409.24574.camel@edumazet-glaptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, 2013-01-02 at 20:47 +0000, Eric Wong wrote: > Eric Wong wrote: > > [1] my full setup is very strange. > > > > Other than the FUSE component I forgot to mention, little depends on > > the kernel. With all this, the standalone toosleepy can get stuck. > > I'll try to reproduce it with less... > > I just confirmed my toosleepy processes will get stuck while just > doing "rsync -a" between local disks. So this does not depend on > sendfile or FUSE to reproduce. > -- How do you tell your 'toosleepy' is stuck ? If reading its output, you should change its logic, there is no guarantee the recv() will deliver exactly 16384 bytes each round. With the following patch, I cant reproduce the 'apparent stuck' --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/toosleepy.c b/toosleepy.c index e64b7cd..df3610f 100644 --- a/toosleepy.c +++ b/toosleepy.c @@ -15,6 +15,7 @@ #include #include #include +#include struct receiver { int rfd; @@ -53,6 +54,7 @@ static void * recv_loop(void *p) ssize_t r, s; size_t received = 0; size_t sent = 0; + time_t t0 = time(NULL), t1; for (;;) { r = recv(rcvr->rfd, buf, sizeof(buf), 0); @@ -80,9 +82,12 @@ static void * recv_loop(void *p) write(-1, buf, sizeof(buf)); } } - if ((received % (sizeof(buf) * sizeof(buf) * 16) == 0)) + t1 = time(NULL); + if (t1 != t0) { dprintf(2, " %d progress: %zu\n", rcvr->rfd, received); + t0 = t1; + } } dprintf(2, "%d got: %zu\n", rcvr->rfd, received); if (rcvr->sfd >= 0) {