Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp884915rdb; Tue, 30 Jan 2024 01:11:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHpdkyCSFYHJLklgcS4GAL+q4rUXfxZ2btDx17UOL6xjfiB4nhXDhUg+swxWeEG8mc09e9t X-Received: by 2002:a17:90a:2d83:b0:294:4fc9:951d with SMTP id p3-20020a17090a2d8300b002944fc9951dmr1084894pjd.31.1706605913211; Tue, 30 Jan 2024 01:11:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706605913; cv=pass; d=google.com; s=arc-20160816; b=iUGjug/UlD/DCiLuIhXwnTXVmNLVqfiWk46xL+D0gj95tBRAF/UndP+KyUXwhdWIa1 MjF+B1ScpdDn3IRiDX/0mPJKM21a2sSuIGxCduJKG84qR1rauH/M8RzhxNDMFPn/zYMR kHfjClanibljyJvgpWA9ZVCvyRi20QNKjd8N84Y+ZZTZYiNxXYN0hhvfDDl/0t6L0zHo OJxZq2wpSMdzeJQdIvYaBmrcjqgEdCKvv21jh6GD6TzQ8h3/Sm+aEqSl5a+UtcTdGz3v b90ieOYuvCtDItNnK9OjdStmf65hp27yt6Lijmfo6DM9zU/a1S9BirQG2GksTBTYV48q 5i7w== 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=xDU/2MwbFRllUTNWUINgIIfQ9WlIfROwCcs26QMTgo4=; fh=ZKA698pTLSxlNFtxfPez4L5htXmd7zXEwSEFwKJEuwo=; b=NA09wG23cCtfibtAEY6QD19Rrm2yS5c6zcaQHQZ0aHE2MAH2MPkHlIvdXSyLgLhcMM x4s88duEZ5vvaWgapsB8QSNS/8xEa70Q+VZakboUcX3uHL+wHTEWZof4zzFm3RKieBWR HZzMGHUoKOtzatYfnvdUJdDaNfDLLJ8jifEeNR7BkghKJXj+LQ3uKs0m1l2j8sZuorjp qEXCmEig7D0CopN5zNXZIJtpEz+4ChPvS7JhVWjt9IsNqBXHAsLKOvuCN4+i2UB7+hCT +P8a4sl0VyeM0BSxA7fcfmMTW+CrCjjWkvxnN2lBgs2TqR+K2yvFP4nFG9/bvPJAP0+/ Nlew== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DPdwzMVf; 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-44150-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44150-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. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o28-20020a63921c000000b005d8e38097f8si842417pgd.265.2024.01.30.01.11.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 01:11:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44150-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DPdwzMVf; 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-44150-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44150-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 A5A39B2A279 for ; Tue, 30 Jan 2024 08:38:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E6D458210; Tue, 30 Jan 2024 08:38:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DPdwzMVf" Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 F2A04381B4; Tue, 30 Jan 2024 08:38:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706603892; cv=none; b=ARTl5NUhMZbCw7lxYQG43GVbXi0GIRsi/lSYuXTDZS0xjCe57jr0zwQb5E7VCV1f5CSpwJPP913zAneQWDMfqLdsUpz4T1dUOece/ScTkfU9dmEqxO8+xvmi6AkruR444dAiR83ZEyQxKmg2g/K3UPxtTGmNAzq50C9qeQP+e/A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706603892; c=relaxed/simple; bh=OH4l3l+PiVerAo7bJ29F5CDHx+9RNN4LLhE2EUaq0/o=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=d8TecrDxI8zrbV0FQjzYQahKVH6jSUB7layyxRcrHBKO+XJeF3bI+xQKsv+jnDL6syVmcbcF3uSRa4tu+RS4jb1FyB3poLld71Ba99qOwAYiZedCEj5qbTe7Z9Bu5Z3aocgGOHzJJfjPxhJpMKnoizCuPe7vxGJxQeVwcF3bA64= 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=DPdwzMVf; arc=none smtp.client-ip=209.85.208.173 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-lj1-f173.google.com with SMTP id 38308e7fff4ca-2d057003864so8108501fa.3; Tue, 30 Jan 2024 00:38:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706603889; x=1707208689; 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=xDU/2MwbFRllUTNWUINgIIfQ9WlIfROwCcs26QMTgo4=; b=DPdwzMVfR+GilX4dx8lFm1KucgtHzrmOS7RT01lxWODOAf9x0Y0sbHQph3vXDvBY1s 9EKWL6OIrx54nNdKyPgU+hYluaSQskYet4APeSA6MJ1tgeuDt43SNeovhvjx/SfgdKKx L+qspfg2w6pVs+0qW4gf5LPq8brnwbuPgxRSej6Z2wLdWySjuPDALXDifhuH+55G85Ar szbTjC/Ed+HzlwuwYfbQMVLhzxdn/XhuPtQNxYlf1CO0wlbU7rpCxjJXJUVSYGz3ZFPj tK0pFFJoPJrs6wpRun+D3PMTSvVKP/hA4hL3qisphgEf3OnpQmFKSP/s3H4E+pa3gJfX MMHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706603889; x=1707208689; 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=xDU/2MwbFRllUTNWUINgIIfQ9WlIfROwCcs26QMTgo4=; b=cBHwsvPfM+F/Ku+kvakQb+AwQ+Rndekfyt8MNKEyY97WuQll8nR1TQDsV3DLK9KTG0 uHVJiY3S4neJay5SWrCZIDe4mWTikkwd7BsGPxdLCfUAjKEqSCgKx/QWw3TOPPVDtjVz gWXVj/0u6goAr2xhcBdrl0OQYe8m9ZPOpcJPG0UyrKKphbfElfK9kmkE+Iwcjn3M9vwh NA4EP9zSnLWp1L4rPLk5aLA5mlyQGfezVbchUmRfoEbfMgWA4y34PXMa++MQjpPImgdB Cmo/G5TQyUWhF00fu7upDDEr/znA9KRuw+gfrw+DZPHzNjbAWpm8rEyguMj3x9VsBsmv vmeA== X-Gm-Message-State: AOJu0YzRYZSwJpXA3zyS1PYmCYP/1WPQfDUX/uNiQqnBhTAUDVikps67 WmzA2Wq3doMvqDL619M1IFSpcIW8TgNabhlAeB4YF+cJwFinXpQvKZ5u8Py8Pn2QnLJqmame3UZ 19lnK4mnT1uuzdWmtxu0PKCBXjNQ= X-Received: by 2002:a2e:a278:0:b0:2d0:4c36:8cbf with SMTP id k24-20020a2ea278000000b002d04c368cbfmr2772545ljm.16.1706603888667; Tue, 30 Jan 2024 00:38:08 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240126120800.3410349-1-zhaoyang.huang@unisoc.com> In-Reply-To: From: Zhaoyang Huang Date: Tue, 30 Jan 2024 16:37:46 +0800 Message-ID: Subject: Re: [PATCHv4 1/1] block: introduce content activity based ioprio To: Matthew Wilcox Cc: "zhaoyang.huang" , Andrew Morton , Jens Axboe , Yu Zhao , Damien Le Moal , Niklas Cassel , "Martin K . Petersen" , Hannes Reinecke , Linus Walleij , linux-mm@kvack.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, steve.kang@unisoc.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jan 26, 2024 at 10:24=E2=80=AFPM Matthew Wilcox wrote: > > On Fri, Jan 26, 2024 at 08:08:00PM +0800, zhaoyang.huang wrote: > > +#ifdef CONFIG_CONTENT_ACT_BASED_IOPRIO > > +#define bio_add_page(bio, page, len, offset) \ > > + ({ \ > > + int class, level, hint, activity; \ > > + int ret =3D 0; \ > > + ret =3D bio_add_page(bio, page, len, offset); = \ > > + if (ret > 0) { \ > > + class =3D IOPRIO_PRIO_CLASS(bio->bi_ioprio); = \ > > + level =3D IOPRIO_PRIO_LEVEL(bio->bi_ioprio); = \ > > + hint =3D IOPRIO_PRIO_HINT(bio->bi_ioprio); = \ > > + activity =3D IOPRIO_PRIO_ACTIVITY(bio->bi_ioprio)= ; \ > > + activity +=3D (bio->bi_vcnt + 1 <=3D IOPRIO_NR_AC= TIVITY && \ > > + PageWorkingset(&folio->page)) ? 1 : 0; = \ > > I know you didn't even compile this version. sorry for forgetting to enable corresponding fs, it will be corrected in the next patchset. The correct version is compiled and verified by including act_ioprio.h in the below files in the same android environment as the previous version. modified: fs/erofs/zdata.c modified: fs/ext4/page-io.c modified: fs/ext4/readpage.c modified: fs/f2fs/data.c modified: fs/mpage.c > > More importantly, conceptually it doesn't work. All kinds of pages > get added to bios, and not all of them are file/anon pages. That > PageWorkingset bit might well be reused for other purposes. Only > the caller knows if this is file/anon memory. You can't do this here. > I noticed the none-file bio's you mentioned such as the one in xfs_rw_bdev() and fscrypt_zeroout_range(). That's also the reason I don't define the macro in common fs's header file. It should be up to fs to decide which bio_add_xxx should be replaced by the activity based one while keeping others as legacy versions.