From patchwork Fri Mar 11 19:06:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Becker X-Patchwork-Id: 12778527 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA638C433EF for ; Fri, 11 Mar 2022 19:06:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350245AbiCKTHj (ORCPT ); Fri, 11 Mar 2022 14:07:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351026AbiCKTHi (ORCPT ); Fri, 11 Mar 2022 14:07:38 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 098DF1AE66C for ; Fri, 11 Mar 2022 11:06:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647025592; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5WYkCapJcg41PfIySIH3qxCTv6VznYmg5KiXMXL3IY0=; b=A76UgdQB8ECzSdcWiDY3rnOSDbS3nLDvDQTsPpMeGIiBN1OqXiBGaipDaYPb+g8mQRH55W zbljRo9xY8SjbGau2WeXBEDveFtY6AEzccwWgf0jsoa5l7EEPzNIAK0x4OJ/TDWhK8G9AC mllOu9Iz3oVRn/1pj32waeZgzHDV/90= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-554-VbP5CgP5P2i3pv3mWNNOvw-1; Fri, 11 Mar 2022 14:06:30 -0500 X-MC-Unique: VbP5CgP5P2i3pv3mWNNOvw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 964F41091DA0; Fri, 11 Mar 2022 19:06:29 +0000 (UTC) Received: from nyarly.rlyeh.local (ovpn-116-72.gru2.redhat.com [10.97.116.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EC8F660BF4; Fri, 11 Mar 2022 19:06:25 +0000 (UTC) From: Thiago Becker To: linux-nfs@vger.kernel.org Cc: steved@redhat.com, trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, kolga@netapp.com, Thiago Becker Subject: [RFC v2 PATCH 0/7] Introduce nfs-readahead-udev Date: Fri, 11 Mar 2022 16:06:10 -0300 Message-Id: <20220311190617.3294919-1-tbecker@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Recent changes in the linux kernel caused NFS readahead to default to 128 from the previous default of 15 * rsize. This causes performance penalties to some read-heavy workloads, which can be fixed by tuning the readahead for that given mount. Specifically, the read troughput on a sec=krb5p mount drops by 50-75% when comparing the default readahead with a readahead of 15360. Previous discussions: https://lore.kernel.org/linux-nfs/20210803130717.2890565-1-trbecker@gmail.com/ I attempted to add a non-kernel option to mount.nfs, and it was rejected. https://lore.kernel.org/linux-nfs/20210811171402.947156-1-trbecker@gmail.com/ Attempted to add a mount option to the kernel, rejected as well. I had started a separate tool to set the readahead of BDIs, but the scope is specifically for NFS, so I would like to get the community feeling for having this in nfs-utils. This patch series introduces nfs-readahead-udev, a utility to automatically set NFS readahead when NFS is mounted. The utility is triggered by udev when a new BDI is added, returns to udev the value of the readahead that should be used. The tool currently supports setting read ahead per mountpoint, nfs major version, or by a global default value. Thiago Becker (7): Create nfs-readahead-udev readahead: configure udev readahead: create logging facility readahead: only set readahead for nfs devices. readahead: create the configuration file readahead: add mountpoint and fstype options readahead: documentation .gitignore | 6 + configure.ac | 4 + tools/Makefile.am | 2 +- tools/nfs-readahead-udev/99-nfs_bdi.rules.in | 1 + tools/nfs-readahead-udev/Makefile.am | 26 +++ tools/nfs-readahead-udev/config_parser.c | 25 +++ tools/nfs-readahead-udev/config_parser.h | 14 ++ tools/nfs-readahead-udev/list.h | 48 ++++ tools/nfs-readahead-udev/log.h | 16 ++ tools/nfs-readahead-udev/main.c | 211 ++++++++++++++++++ .../nfs-readahead-udev/nfs-readahead-udev.man | 47 ++++ tools/nfs-readahead-udev/parser.y | 85 +++++++ tools/nfs-readahead-udev/readahead.conf | 15 ++ tools/nfs-readahead-udev/scanner.l | 19 ++ tools/nfs-readahead-udev/syslog.c | 47 ++++ 15 files changed, 565 insertions(+), 1 deletion(-) create mode 100644 tools/nfs-readahead-udev/99-nfs_bdi.rules.in create mode 100644 tools/nfs-readahead-udev/Makefile.am create mode 100644 tools/nfs-readahead-udev/config_parser.c create mode 100644 tools/nfs-readahead-udev/config_parser.h create mode 100644 tools/nfs-readahead-udev/list.h create mode 100644 tools/nfs-readahead-udev/log.h create mode 100644 tools/nfs-readahead-udev/main.c create mode 100644 tools/nfs-readahead-udev/nfs-readahead-udev.man create mode 100644 tools/nfs-readahead-udev/parser.y create mode 100644 tools/nfs-readahead-udev/readahead.conf create mode 100644 tools/nfs-readahead-udev/scanner.l create mode 100644 tools/nfs-readahead-udev/syslog.c