lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 21 Jul 2021 12:44:04 +0300
From:   Mike Rapoport <rppt@...nel.org>
To:     "Matthew Wilcox (Oracle)" <willy@...radead.org>
Cc:     linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        linux-fsdevel@...r.kernel.org, Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v14 040/138] mm/memcg: Convert mem_cgroup_charge() to
 take a folio

On Thu, Jul 15, 2021 at 04:35:26AM +0100, Matthew Wilcox (Oracle) wrote:
> Convert all callers of mem_cgroup_charge() to call page_folio() on the
> page they're currently passing in.  Many of them will be converted to
> use folios themselves soon.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
> Reviewed-by: Christoph Hellwig <hch@....de>
> ---
>  include/linux/memcontrol.h |  6 +++---
>  kernel/events/uprobes.c    |  3 ++-
>  mm/filemap.c               |  2 +-
>  mm/huge_memory.c           |  2 +-
>  mm/khugepaged.c            |  4 ++--
>  mm/ksm.c                   |  3 ++-
>  mm/memcontrol.c            | 26 +++++++++++++-------------
>  mm/memory.c                |  9 +++++----
>  mm/migrate.c               |  2 +-
>  mm/shmem.c                 |  2 +-
>  mm/userfaultfd.c           |  2 +-
>  11 files changed, 32 insertions(+), 29 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index c2ffad021e09..03283d97b62a 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -6697,27 +6696,27 @@ static int __mem_cgroup_charge(struct page *page, struct mem_cgroup *memcg,
>  
>  	local_irq_disable();
>  	mem_cgroup_charge_statistics(memcg, nr_pages);
> -	memcg_check_events(memcg, page_to_nid(page));
> +	memcg_check_events(memcg, folio_nid(folio));
>  	local_irq_enable();
>  out:
>  	return ret;
>  }
>  
>  /**
> - * mem_cgroup_charge - charge a newly allocated page to a cgroup
> - * @page: page to charge
> - * @mm: mm context of the victim
> - * @gfp_mask: reclaim mode
> + * mem_cgroup_charge - Charge a newly allocated folio to a cgroup.
> + * @folio: Folio to charge.
> + * @mm: mm context of the allocating task.
> + * @gfp: reclaim mode
>   *
> - * Try to charge @page to the memcg that @mm belongs to, reclaiming
> - * pages according to @gfp_mask if necessary. if @mm is NULL, try to
> + * Try to charge @folio to the memcg that @mm belongs to, reclaiming
> + * pages according to @gfp if necessary.  If @mm is NULL, try to
>   * charge to the active memcg.
>   *
> - * Do not use this for pages allocated for swapin.
> + * Do not use this for folios allocated for swapin.
>   *
>   * Returns 0 on success. Otherwise, an error code is returned.

Missing return description

>   */
> -int mem_cgroup_charge(struct page *page, struct mm_struct *mm, gfp_t gfp_mask)
> +int mem_cgroup_charge(struct folio *folio, struct mm_struct *mm, gfp_t gfp)
>  {
>  	struct mem_cgroup *memcg;
>  	int ret;

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ