From owner-freebsd-arch@FreeBSD.ORG Fri Jan 10 20:49:53 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8C9DC961 for ; Fri, 10 Jan 2014 20:49:53 +0000 (UTC) Received: from mail-qc0-x22b.google.com (mail-qc0-x22b.google.com [IPv6:2607:f8b0:400d:c01::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4F06D1E51 for ; Fri, 10 Jan 2014 20:49:53 +0000 (UTC) Received: by mail-qc0-f171.google.com with SMTP id n7so2869106qcx.16 for ; Fri, 10 Jan 2014 12:49:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=aRW5VrbeVS6U97GygAVZAaPh8jG3isQmei/BgJnq3C4=; b=qSGNklj91xDmFpsvaIL8awDwVipL6OEg95XKEY9+/xBIUQl/tLMmKIs/44wtgx0tzu ZHToJD/ZvRuHbNL2JkIY/iWs+XXCOPurrulFidRJNdSx4UDpM34ZUWkMM1eSOzu4RtZu v3X/QD8jyYQ3sSTS7LxvE2xTzNIIhUQd6Ts5oKKXr8f5kDgXA9JeXuQ2QDcDSYN6cCbI WYDzeF5J/p2eDXAktDF7f7YHucDGWx1Fn36BXMSgbBB2rhhcEvc4vGV0p/zaCaJO3umj Yu1eTiDX5xxncqLyL9UGtyU15vtherWC9xJOOMvc6CWlQQ1AZ3YcPDcIYtBD5TVk5giw cn1A== MIME-Version: 1.0 X-Received: by 10.224.124.195 with SMTP id v3mr11555332qar.55.1389386992447; Fri, 10 Jan 2014 12:49:52 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.52.8 with HTTP; Fri, 10 Jan 2014 12:49:52 -0800 (PST) Date: Fri, 10 Jan 2014 12:49:52 -0800 X-Google-Sender-Auth: acjX5s7xGo8vvuG7qbWQUvcz8Ng Message-ID: Subject: pmc pmc_processhash_mtx - increasing lock contention as context switch rate increases From: Adrian Chadd To: "freebsd-arch@freebsd.org" Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jan 2014 20:49:53 -0000 Hiya, Here's another gem that has surfaced during my lab tests. There's a single lock over the PMC descriptor list that gets acquired during pmc_find_process_descriptor() and pmc_remove_process_descriptor(). Trouble is, the find function is called during context switch in and context switch out. This means that as the context switch rate goes up, the contention on that lock also goes up. For some erm, disk/network IO intensive workloads where the context switch rate rises to above 500,000 context switches a second, it can get a little ridiculous. I'm re-reviewing the code to see if I can see an obvious way to remove the contention on this lock in a non-racy way. Does anyone have any ideas? Thanks! -a