From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) (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 0DCBA4C77A4 for ; Tue, 9 Jun 2026 17:44:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781027083; cv=none; b=Ccj3q+vnOEsjGX0uFCNtp9/vKJintjPlNITq98CVEweiyszq3ZYbKqDT4/qe455M7KH1fe2haERBBQAxLwsDeZFLgreLgy8RnXQGO/L1dUL2dDVrQDmiVRjy6SzvCR48HZx6DbWSA4Nuqvikn41v52WS6MYAPCS1SJ6vEK60hHI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781027083; c=relaxed/simple; bh=OWhqozJogc4m0bZyL7rRg35X5SMI57nY2eOTetEs3aM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GmK4+rWmbW43t0Cvs52sQBSqRRL17ekpIlmI10MEawOOFnXF1gjY4WtuYapT0BccLf5ZqIm9i9ZOsKjzM9/kvIHzyVHE+EsWiBDOFhHa73haVHwRoKV33n+As91AJjVAYvVvj6zaW6DDDefR9+wvBemNG4KbOw5HvCilZyPCiR8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=cVZZwimV; arc=none smtp.client-ip=209.85.219.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="cVZZwimV" Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-8ccda0ac4fcso59412166d6.2 for ; Tue, 09 Jun 2026 10:44:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1781027081; x=1781631881; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=taYzpL3NOUpJl8K0/+Ucx7wOW5hZPsWROMd3M/VgR5g=; b=cVZZwimVFh9NFHTfJRjSfVMGFHjQU4vXzC4O1fUfCPoe2JRV/Gr/DaCyN+yP4kI9wP 6xNrD+GkQVFug+WVLAFNOKzbfsF8/WDxYEYKGVKG/k+ePT0oHULZbLlv3evrdEsOFGEP WmJawd3m9BLH2GpvHJ1R8DSV1/WW61uKKL5pfWlehv5KPvGzFLOAShom0PJ6qL46XlIm cy25v/Q4IFwMPtOzJE1d6nuU6siKC5FmmpgpwYe3EU3BvizHl3EIFzl3jf5RFmOHMifX uSKlpxVRKbkUeQAq8MBudVh2AAKGVQUb7giRFaIIOXrlGCtUIG5WIbFs+YvPrt0UJkMN VZYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781027081; x=1781631881; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=taYzpL3NOUpJl8K0/+Ucx7wOW5hZPsWROMd3M/VgR5g=; b=a7DN6TQmx77Mn5wU19k9bEhOA/NHxZN2fWnJBNGJR4dHHenlgeQ8TvyssQLrSQp0Av v4gEyoLXcbx7e9e+AfxlHH5E+eR1KfzFkvK7Tus5wayCmdrZFge4KMEOkrlOYN7FfesG xxPnWI+kNGEBWcqoTDKCQqUNUZdB9Sd2cQoJx46E2+fL79fo3C5hCCKodEXPksS6AGbk qasQ+Twjzc1gNt+4pj1u6BVnhOeqiriVKQm5/OtKcQM3ljAg84uErVdMFw3l6kGaaBiu DLtcFEZQbVvIljY3e/bJu4D8r+aFF+Dn4Lmsup2b1Ofa0jiyTXhdDoGVCbhlXSY7cg4r PAOg== X-Gm-Message-State: AOJu0YxzzFN2aM4Jh4H9D+bS0ly+wLHa6E0bDz+pgRqyXJzTJ3Kazp4S DaSvskFT3bMHv+ZhPK2SgUbYJzauOUmQzr7p8jYo/z7KkIqddLlyIgc1ulzIJ550srE= X-Gm-Gg: Acq92OHeXdkCRT0RcnNy+89vfiIQEi6UVbeGqV0jdjk5RmBtLQNNzTzmBW5/9blF/8u AdFYsvUGvZTnDdtrlP8nhub5TTmsGqM6sqmOl86wZa8JiJfpWkRZLE6TEBSPGDjai7mjJe3domf +MH5pTI3f8drzCDHR201QdMxY7Paq49WLqKW87PL1QJEyNJUEAuCI7dADjv5NfOEKT8+A9o/j6j w9KDbz2LMsvKgSrm/XRgohdUclR+OqU+0X8OHGUWen89Fc/VLCvuv09DGEemrQZLjbjCLsbcRFM /xz+VZ7TsDUPK6HuOi4ezhFoNfqpomKaFAQsBpkNvHjwUouV9cjlZmgRwILQHz7pI2SYKVImBrO umwmb+CXExTBc6C7Md9l88vct6JPfZkc7ml0cRXvx95Wuz30TZT2KBPrhPiX8EnFSJigtQXEHPh LLtP8xQZG6xCE6lZdLg+Yb4fP5e1jfKAbxmcWLvaAK0xkyXfZoYTRzJZNynEooFMyDQ/iD9NAJz y1/CgFIm7uw1fcq4A== X-Received: by 2002:a05:6214:262a:b0:8b3:fb6a:d370 with SMTP id 6a1803df08f44-8cf1dcfe9dbmr56987546d6.37.1781027080849; Tue, 09 Jun 2026 10:44:40 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-173-79-60-52.washdc.fios.verizon.net. [173.79.60.52]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8ceccdb915csm211312426d6.14.2026.06.09.10.44.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 10:44:39 -0700 (PDT) Date: Tue, 9 Jun 2026 13:44:37 -0400 From: Gregory Price To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, Miaohe Lin , "David Hildenbrand (Arm)" , Jason Wang , Xuan Zhuo , Eugenio =?iso-8859-1?Q?P=E9rez?= , Muchun Song , Oscar Salvador , Andrew Morton , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Hugh Dickins , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Ying Huang , Alistair Popple , Christoph Lameter , David Rientjes , Roman Gushchin , Harry Yoo , Axel Rasmussen , Yuanchu Xie , Wei Xu , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , virtualization@lists.linux.dev, linux-mm@kvack.org, Andrea Arcangeli , Naoya Horiguchi , Alexander Duyck Subject: Re: [PATCH splitout] mm: page_reporting: allow driver to set batch capacity Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Jun 09, 2026 at 11:53:20AM -0400, Michael S. Tsirkin wrote: > --- a/mm/page_reporting.c > +++ b/mm/page_reporting.c > @@ -174,10 +174,10 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, > * list processed. This should result in us reporting all pages on > * an idle system in about 30 seconds. > * > - * The division here should be cheap since PAGE_REPORTING_CAPACITY > - * should always be a power of 2. > + * The division here uses integer division; capacity need > + * not be a power of 2. > */ > - budget = DIV_ROUND_UP(area->nr_free, PAGE_REPORTING_CAPACITY * 16); > + budget = DIV_ROUND_UP(area->nr_free, prdev->capacity * 16); > Initial look - is there a div-by-0 here? I noticed the old check prevents this from being (0 * 16), but i don't see (on first pass) the same check anywhere. Unless this line below always forces the above to be a PAGE_REPORTING_CAPCAITY if it's set to 0. > + if (!prdev->capacity || prdev->capacity > PAGE_REPORTING_CAPACITY) > + prdev->capacity = PAGE_REPORTING_CAPACITY; > + It's worth making this corner condition a little more obvious. The code intends for if (capacity == 0) capacity = PAGE_REPORTING_CAPACITY but that's not reflected in the changelog as a default value. When happens if a driver sets (capacity=0) either on purpose (???) or because there's a bug (???) and then page_reporting.c forces it up to 32? There's something to improve here. ~Gregory