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]
Message-ID: <l2o412e6f7f1005052022td6db0c2g4afccb5f006366ff@mail.gmail.com>
Date:	Thu, 6 May 2010 11:22:03 +0800
From:	Changli Gao <xiaosuo@...il.com>
To:	Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
Cc:	eric.dumazet@...il.com, jslaby@...e.cz, viro@...iv.linux.org.uk,
	paulmck@...ux.vnet.ibm.com, adobriyan@...il.com, mingo@...e.hu,
	peterz@...radead.org, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org, avi@...hat.com,
	akpm@...ux-foundation.org
Subject: Re: [RFC] mm: generic adaptive large memory allocation APIs

2010/5/6 Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>:
> Changli Gao wrote:
>> struct kvfree_work_struct {
>>       struct work_struct      work;
>>       void                    *head;
>>       void                    **ptail;
>> };
>
> I wonder why "struct kvfree_work_struct" is needed.
> According to http://kernel.ubuntu.com/git?p=jj/ubuntu-lucid.git;a=blobdiff;f=security/apparmor/match.c;h=d2cd55419acfcae85cb748c8f837a4384a3a0d29;hp=afc2dd2260edffcf88521ae86458ad03aa8ea12c;hb=f5eba4b0a01cc671affa429ba1512b6de7caeb5b;hpb=abdff9ddaf2644d0f9962490f73e030806ba90d3 ,
>
> static void kvfree_work(struct work_struct *work)
> {
>        vfree(work);
> }
>
> void kvfree_inatomic(void *ptr, size_t size)
> {
>        if (size < PAGE_SIZE) {
>                kfree(ptr);
>        } else if (is_vmalloc_addr(ptr)) {
>                /*
>                 * We can embed "struct work_struct" inside *ptr
>                 * because size >= PAGE_SIZE.
>                 */
>                struct work_struct *work = ptr;
>                BUILD_BUG_ON(sizeof(struct work_struct) > PAGE_SIZE);
>                INIT_WORK(&work, kvfree_work);
>                schedule_work(&work);

&work should be work. It is a much better idea. thanks very much.

>        } else {
>                free_pages_exact(ptr, size);
>        }
> }
>
> should do what you want. (Though, I didn't test it.)
>

-- 
Regards,
Changli Gao(xiaosuo@...il.com)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ