Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp234230lqo; Thu, 9 May 2024 19:43:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU1B+0HFanxcaoZLRoXu41D3OXbTFTfbR8kvi7Z7gUcvPQh4bZZXWB+9BuQoIVKUfpWqM5MyuKN4PXJsequZIKzKqOOKL7jUkCekHQUbg== X-Google-Smtp-Source: AGHT+IEwB1DJFXWwOe44bX2E4bVhRUqWws+HW9bkPUuclJBCUwrfWBJW94rwUHzHoUkUfwOhUq5v X-Received: by 2002:a05:6870:944f:b0:23f:ba54:5f41 with SMTP id 586e51a60fabf-24172a3f4d5mr1669663fac.1.1715309027263; Thu, 09 May 2024 19:43:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715309027; cv=pass; d=google.com; s=arc-20160816; b=ginrer9bG3pd/pqNpOukbUsCk79Lx5EGpHYzSe6DYcQIoDxAwSvZoA7+o7fwvV266K 7fMIkduDCCI2dxXIk1joEEDzqXdpkjj3gSI9rTxZlynB9xnSmlWecjM5VAeWWHt4MC/v 6NQKqhQbuYzDq/PqRtitQGt765SPurxfRKBCaV4EG0b4YMi6XZ6hHiOngMBbBbpu3zub bg7BwwRua/33NAQ2yYwjdhqSjMGWE3W4e8Q56VWC8NrtHewAiMDsvfHn5RorLenk8ZeH 1aZ18rhRultuY9z5J4CmdNOZ5wtk9kOrHFIssTXU1InQvEBnTdTGFjiKLuYSBMZW5dQT vabA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=g8bWLxZ3dWuYmospB5SpCzowfyzVsObI//ksFh6x8MM=; fh=O4FD4QWNjdf/4ki+NoLe6IHrCIaNnKSogsi6Lp7ixyk=; b=TlA2xuZyRmPjYFmHGOLFPGE1uw7maT4T/V3vT9cBQvfC9j8ZcKFQLYqsj3/BLdyccN JPijPT3nTleEOqzqB40RjCBqsqvl/u2NKlTCoNZZiN+foEtM2t+n65cB4HwoH8sULxIM QMzk+w7cC1WZXiT4Y+m3n0TxZFdPYQSJs4IapEFMNbYd4A5svCtFP1hlM712qv/KDl1l rbDIZIPt2cL5MkJKbeFXcCWHV4wRiSJIzpVPMHL5t79JkT9z4O6mtbv9QNC4ePfXz82e aT+4sWENbR8NuZoydcTZWDhApQPo+y9fPuZYY2xc3yr4yLFaXTFBeqjGR8AW5zddakbr kLkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KVGoX4Dd; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-175220-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2a72697si2772808b3a.10.2024.05.09.19.43.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 19:43:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175220-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KVGoX4Dd; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-175220-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 78DBBB215CE for ; Fri, 10 May 2024 02:43:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28F79148852; Fri, 10 May 2024 02:43:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KVGoX4Dd" Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1A9F5579A; Fri, 10 May 2024 02:43:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715309015; cv=none; b=LidnE36AUEGXhLP0LMvfDm88v5vLidhfHgfCHWN5YR8hulFaKs1Ujz+XQSK1maBOWAoY498yyr2S9s4V72rkNh+Yyo5OrKxu8SatWhLJn/Ae+OUQJ047wRG2rANkMVnodH5GJiOBhp+nhsKhLT5shJukuB3txGtlJ1MqBCcf8J8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715309015; c=relaxed/simple; bh=h3NjcfgxQkvN6Dm0qeLjtqzQYAbriKkylaDfBSkN64s=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=g7SZE3xTqutgtjVfoXIDFaZ1/kXcg4jAmRfRJKWnlCf/hBLd7yqmQt/M9ExYaZQTH6IYr5OtnbLjH1/cFK5dTOFyzBx4Aw7r/R0ZLHfMaiobVwBVjicOVVWbRbS6LRkDex3yOGXJo5BlHu6KeVVTUGzei8Xgn9koNw4pVDyUvG8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KVGoX4Dd; arc=none smtp.client-ip=209.85.167.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-51f12ccff5eso2040882e87.1; Thu, 09 May 2024 19:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715309012; x=1715913812; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=g8bWLxZ3dWuYmospB5SpCzowfyzVsObI//ksFh6x8MM=; b=KVGoX4Dd5Doh9ccJ/9Qk4EPsRZ/jx5xVFsAX4Gu2688Z2F5Et5YZOnpd0D/xpRh7Ln rcIzN4Cvgvjw446x5EW3MNnJv9PDsPTFhpFryVTeD882v4xnkQ7XNfpWJz3QGJQOoooB p9e0iX0VR7ZHJ5w/xfOReu3076wy2bLKNCCEHGjkI6y75f/pPj2KRdQa/nHsZ6yZQKHg KG9l5ci2XZb+Q1tAroPGZ9bhV6qxz8QiM3YLrYAO94lZeAyiFt8ktkcqD+Nfk6pujX0H KyoRWTcRErtHqLQSJQ56imViZ+TfOpppAv/xcRz+eNZU5gHE0iPVmupL76BV3G5ox3n5 xb/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715309012; x=1715913812; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g8bWLxZ3dWuYmospB5SpCzowfyzVsObI//ksFh6x8MM=; b=vMZ7MXZ3Jgq7sqKkmraCzWKNcu2VdDKH3v7cIst3+krbtyANQnn4JXvQMLGT3Zk3/0 MOa7GZwJWQnAUZhJoGIX3ozy6dPsqiuTYUDisJgLHDdGn99Zek71GdMesTcaMf7dppj4 IJN8fM3HxLaMk7bpC/rYpDSF8ruFN3A3kEF7GEvz4IssJ44rZbhmsYJEkMYmUTZnUW/q GzbKGv9a0/pxikDzb49wpPgMUjnaStHXXmwm1Kc6NCvq9F0mODSzxTDo+/bpe1LElRrt 3NtzL6JcmMdUIC6w8sdEpUscXK8SWTGjJaIvyhqNZI5Plu8RA1CnP9kV4a14k7xsUD1v +/6Q== X-Forwarded-Encrypted: i=1; AJvYcCU/R50IymvCri1PNYMt12bPnDJ55AnZi5OW4QZcr3NOgNSQ+s8kn8kZLWtxmCoGp+UfEuKaCyjru2QfcMLr9JG1lmh6rD/54lg3Z+Q5kBDmhW1EeVysZB6sphYQAz8mkYvVhzeWOfzGomH7fnu8TEWNqC/e8AimBl9WZQFTWI8Cc8if X-Gm-Message-State: AOJu0Yxlh5enc1NHtaDJIVAHB8/mEb+GioQeRx/ujoQjTDcUgQfxZbDq hpr6WkPMkiGGvnuNRh8pM8IduO54guAEhPe/2xR7GVPFkZuFjG65HMy/DeJvbcfWM5iVDwKsxQp h1Eui0qZ0t85n4yI7J7odrwarZhs= X-Received: by 2002:a19:5e4b:0:b0:515:b8d5:c5b7 with SMTP id 2adb3069b0e04-522105844c0mr604760e87.56.1715309011548; Thu, 09 May 2024 19:43:31 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240509023937.1090421-1-zhaoyang.huang@unisoc.com> <20240509023937.1090421-3-zhaoyang.huang@unisoc.com> In-Reply-To: From: Zhaoyang Huang Date: Fri, 10 May 2024 10:43:20 +0800 Message-ID: Subject: Re: [RFC PATCH 2/2] mm: introduce budgt control in readahead To: Matthew Wilcox Cc: "zhaoyang.huang" , Andrew Morton , Jens Axboe , Tejun Heo , Josef Bacik , Baolin Wang , linux-mm@kvack.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, steve.kang@unisoc.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 9, 2024 at 11:15=E2=80=AFAM Matthew Wilcox wrote: > > On Thu, May 09, 2024 at 10:39:37AM +0800, zhaoyang.huang wrote: > > -static unsigned long get_next_ra_size(struct file_ra_state *ra, > > +static unsigned long get_next_ra_size(struct readahead_control *ractl, > > unsigned long max) > > { > > - unsigned long cur =3D ra->size; > > + unsigned long cur =3D ractl->ra->size; > > + struct inode *inode =3D ractl->mapping->host; > > + unsigned long budgt =3D inode->i_sb->s_bdev ? > > + blk_throttle_budgt(inode->i_sb->s_bdev) : 0; > > You can't do this. There's no guarantee that the IO is going to > mapping->host->i_sb->s_bdev. You'd have to figure out how to ask the > filesystem to get the bdev for the particular range (eg the fs might > implement RAID internally). > Thanks for the prompt. I did some basic research on soft RAID and wonder if applying the bps limit on /dev/md0 like below could make this work. mdadm -C -v /dev/md0 -l raid0 -n 2 /dev/sd[b-c]1 mount /dev/md0 /mnt/raid0/ echo "/dev/md0 100000" > blkio.throttle.read_bps_device I didn't find information about 'RAID internally'. Could we set the limit on the root device(the one used for mount) to manage the whole partition without caring about where the bio finally goes? Or ask the user to decide if to use by making sure the device they apply will not do RAID?