Re: project ideas

2011-03-10 Thread Anupam Kapoor
,
| > I am seeking for any project on Networking related stuff ( in kernel land).
| > I have visited the kernelnewbies.org janitors and kernel projects. Among
| > them i found two projects of my interest but both of them are completed. So
| > can anyone suggest me any ideas?
| >
| > I would appreciate any suggestions and ideas.
`
if you have not seen this it already, this:
http://vger.kernel.org/~davem/net_todo.html might be helpful.

kind regards
anupam
-- 
In the beginning was the lambda, and the lambda was with Emacs, and
Emacs was the lambda.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Disabling nagle algorithm

2011-05-29 Thread Anupam Kapoor
afaik, it disables tcp-prequeue nothing to do with nagle anyways.
also, doing this might have marginal benefits if anything at all due
to most overhead being specific to context switching than anything
else.

anupam

On Sun, May 29, 2011 at 11:04 PM, C K Kashyap  wrote:
> Hi,
> Is setting net.ipv4.tcp_low_latency to 1 the right way of disabling nagle's
> algorithm?
> Regards,
> Kashyap
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>



-- 
In the beginning was the lambda, and the lambda was with Emacs, and
Emacs was the lambda.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Disabling nagle algorithm

2011-05-29 Thread Anupam Kapoor
is tcp_nodelay not an option ?

anupam

On Mon, May 30, 2011 at 9:21 AM, C K Kashyap  wrote:
>
>
> On Mon, May 30, 2011 at 9:18 AM, Anupam Kapoor 
> wrote:
>>
>> afaik, it disables tcp-prequeue nothing to do with nagle anyways.
>> also, doing this might have marginal benefits if anything at all due
>> to most overhead being specific to context switching than anything
>> else.
>>
> Thanks Anupam ... can you pleast tell me how I could disable nagle's algo?
> At a system level. I've seen a lot of info on socket param on the net.
> Regards,
> Kashyap



-- 
In the beginning was the lambda, and the lambda was with Emacs, and
Emacs was the lambda.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Disabling nagle algorithm

2011-05-30 Thread Anupam Kapoor
yup, that's what i also think. is it possible that nagle+delayed-ack
is causing the perceived slow-down ?

anupam

On Tue, May 31, 2011 at 6:03 AM, Peter Teoh  wrote:
> frankly it is not wise to disable nagle, and the solution i proposed
> (using netfilter extension) is really too tedious - the added overhead
> may slow down the processing, even though disabling nagle aims to
> improve latencies.   but modern network card is so fast, that the
> bottleneck is not at the network card side, but more likely in the
> network gateway, or router side - so u are definitely not going to see
> improvement in spite of all the troubles.
>
> --
> Regards,
> Peter Teoh
>



-- 
In the beginning was the lambda, and the lambda was with Emacs, and
Emacs was the lambda.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Disabling nagle algorithm

2011-05-31 Thread Anupam Kapoor
yet another option would be to setup point-to-point ethernet device
(^^) via tun/tap drivers. you can have a userland program receiving
data from the said device, and then use whatever options you want
there.

anupam

On Tue, May 31, 2011 at 8:11 AM, Anupam Kapoor  wrote:
> yup, that's what i also think. is it possible that nagle+delayed-ack
> is causing the perceived slow-down ?
>
> anupam
>
> On Tue, May 31, 2011 at 6:03 AM, Peter Teoh  wrote:
>> frankly it is not wise to disable nagle, and the solution i proposed
>> (using netfilter extension) is really too tedious - the added overhead
>> may slow down the processing, even though disabling nagle aims to
>> improve latencies.   but modern network card is so fast, that the
>> bottleneck is not at the network card side, but more likely in the
>> network gateway, or router side - so u are definitely not going to see
>> improvement in spite of all the troubles.
>>
>> --
>> Regards,
>> Peter Teoh
>>
>
>
>
> --
> In the beginning was the lambda, and the lambda was with Emacs, and
> Emacs was the lambda.
>



-- 
In the beginning was the lambda, and the lambda was with Emacs, and
Emacs was the lambda.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: writting NIC driver for IPV6

2011-06-29 Thread Anupam Kapoor
2011/6/29 Gang Lei (雷刚) 

>  Thanks a lot, Michi.
>
> Then how can I verify that IPV6 can be really running on our NIC? Of course
> I have to build a kernel which can support IPV6 firstly, but how to verify
> it’s really working? Use ping6?
>
 yes apart from ping6, you can use:
 1. wireshark/ethereal for seeing ND messages on the wire
 2. if possible, setup ISATAP in your lab-network. ubuntu does have
a isatapd, so should other distributions.
 3. once you have (2) setup, update your resolver to do quad-A
queries by default i.e. 'option inet6'. if you use google's DNS, you should
be able to see dancing turtle at kame.org

for example, i have the following

is0   Link encap:IPv6-in-IPv4
  inet6 addr: 2001:420:5401:1:200:5efe:4067:9c63/64 Scope:Global
  inet6 addr: fe80::200:5efe:4067:9c63/64 Scope:Link
  UP RUNNING NOARP  MTU:1280  Metric:1
  RX packets:1352 errors:0 dropped:0 overruns:0 frame:0
  TX packets:872 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0
  RX bytes:1575341 (1.5 MB)  TX bytes:72571 (72.5 KB)

 can you find out where i work from above ? ;)

have fun...

anupam
-- 
In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Path of network packet in kernel

2014-07-15 Thread Anupam Kapoor
a 'slightly' more indepth look:
http://www.linuxfoundation.org/images/1/1c/Network_data_flow_through_kernel.png

kind regards
anupam

On Tue, Jul 15, 2014 at 10:33 PM, Jeff Haran  wrote:
> This helps me to see the forest for the trees. And it's pretty current:
>
>
>
> http://upload.wikimedia.org/wikipedia/commons/3/37/Netfilter-packet-flow.svg
>
>
>
> Jeff Haran
>
>
>
>
>
> From: kernelnewbies-boun...@kernelnewbies.org
> [mailto:kernelnewbies-boun...@kernelnewbies.org] On Behalf Of Anil Joshi
> Sent: Tuesday, July 15, 2014 7:38 AM
> To: kernelnewbies
> Subject: Path of network packet in kernel
>
>
>
> Hi All,
>
>
>
> I am just new to all this,just wanted to trace the path of the packet since
> it enter the system(inside the kernel (functions and system calls)) and
> reaches the destination application.
>
>
>
> How to do that.
>
>
>
>
>
> Regards
>
>
>
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
In the beginning was the lambda, and the lambda was with Emacs, and
Emacs was the lambda.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Exporting ioctls from out-of-tree module to userspace

2014-07-17 Thread Anupam Kapoor
hi,

in the older kernels (anything before the commit id mentioned below),
there is include/Kbuild, where you can do something like this:

header-y += ../../quick-hacks/kernel-modules/mymodule/

and then do a  'make headers_install' from the *source* tree, which
seems to do the right thing.

in newer kernels, due to 10b63956fce7f369cc37fd4d994f09bd5203efe4, you
need to do the same thing in include/uapi/Kbuild...

kind regards
anupam


On Thu, Jul 17, 2014 at 12:27 AM, Daniel Hilst Selli
 wrote:
> I write an out-of-tree module and now want to export its ioctls to
> userspace by installing a header that my modules includes, I was looking
> for how to do it but can't get it..
>
> I was trying header-y from
> https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt but got:
> make[1]: *** No rule to make target 'headers_install'.  Stop.
>
> Here is what I'm trying: https://gist.github.com/gkos/b0bc4e29a3147b0e6d3b
>
> I see on kernel that usually the exported headers go in
> include/uapi/SOMETHING and are declared on include/uapi/Kbuild.. but
> have no idea if this may work for out-of-tree modules, the
> headers_install exists on linux Makefile so the 'No rule to make target
> 'headers_install'' doesn't make sense to me ..
>
> I try follow headers_install target on kernel's Makefile but only got
> frustraded :(
>
> Any idea?
>
> ps: I compiled the module but don't loaded it, so it may have mistakes
>
> Thanks in advance!
> Cheers!
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



-- 
In the beginning was the lambda, and the lambda was with Emacs, and
Emacs was the lambda.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: userspace stack start and end

2014-07-27 Thread anupam kapoor
> [Sun, 27 Jul 2014 11:52:27 -0500]: "Xin Tong" (xin-tong):

,[ xin-tong ]
| I am trying to find the start and end address of the userspace stack.
| I see in the task_struct there is start_stack. But I could not find
| end_start anywhere in the kernel code ?
| 
| Can someone please tell me how to find the end of the stack ?
`
but that should be computable right e.g.
user:stack-end = user:stack-start + user:stack-segment-size * 
number-of-pages

kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: userspace stack start and end

2014-07-27 Thread anupam kapoor
> [Sun, 27 Jul 2014 22:35:22 -0500]: "Xin Tong" (xin-tong):

,[ xin-tong ]
| where is user:stack-segment-size defined ? 
`
that is computable once again :) (assuming x86, and 1+3 split)
  user:stack-segment-size = ((unsigned long)(0xc000 - user:start-stack)) >> 
PAGE_SHIFT

kind regards
anupam


,[ anupam ]
| ,[ xin-tong ]
| | I am trying to find the start and end address of the userspace
| stack.
| | I see in the task_struct there is start_stack. But I could not
| find
| | end_start anywhere in the kernel code ?
| |
| | Can someone please tell me how to find the end of the stack ?
| 
| `
| but that should be computable right e.g.
| user:stack-end = user:stack-start + user:stack-segment-size *
| number-of-pages
`



___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: which function can replace “create_proc_info_entry” in 2.6.32 of Linux kernel?

2014-08-27 Thread anupam kapoor
> [Wed, 27 Aug 2014 16:59:23 +0800]: "lxgeek" (lxgeek):

,[ lxgeek ]
| hi all:
| The 2.6.32 kernel don't have the function of "create_proc_info_entry".
| Which function can replace it?
| Thank you.
`
commit 80e928f7ebb958f4d79d4099d1c5c0a015a23b93

kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Btrfs Issues

2014-08-27 Thread anupam kapoor
> [Wed, 27 Aug 2014 16:22:56 -0400]: "nick" (nick):

,[ nick ]
| When booting on an Ubuntu kernel I am hitting this in my dmesg with an 
external drive I have.
| I am wondering if this is a bug or just a common issue.
| 8518.918519] [ cut here ]
| [ 8518.918528] WARNING: CPU: 1 PID: 13778 at
| /build/buildd/linux-3.13.0/fs/btrfs/super.c:254
| __btrfs_abort_transaction+0x50/0x110 [btrfs]()
| [ 8518.918529] btrfs: Transaction aborted (error -5)
| [ 8518.918530] Modules linked in: btrfs raid6_pq libcrc32c xor ses
| enclosure usb_storage bnep rfcomm bluetooth hid_generic usbhid hid
| eeepc_wmi asus_wmi sparse_keymap intel_rapl x86_pkg_temp_thermal
| intel_powerclamp coretemp kvm_intel kvm crct10dif_pclmul crc32_pclmul
| ghash_clmulni_intel snd_hda_codec_hdmi aesni_intel aes_x86_64 lrw
| gf128mul glue_helper ablk_helper cryptd serio_raw
| snd_hda_codec_realtek lpc_ich snd_hda_intel snd_hda_codec snd_hwdep
| snd_seq_midi snd_seq_midi_event snd_pcm snd_rawmidi snd_page_alloc
| fglrx(POF) snd_seq parport_pc snd_seq_device snd_timer ppdev wmi
| mei_me snd mei mac_hid lp parport soundcore amd_iommu_v2 video ahci
| libahci r8169 mii
| [ 8518.918560] CPU: 1 PID: 13778 Comm: umount Tainted: PF   W  O 
3.13.0-34-generic #60-Ubuntu
| [ 8518.918561] Hardware name: System manufacturer System Product Name/P8Z68-V 
LE, BIOS 3506 01/17/2012
| [ 8518.918562]  0009 8801c9ad5c50 8171bd94 
8801c9ad5c98
| [ 8518.918564]  8801c9ad5c88 810676cd fffb 
880211d72800
| [ 8518.918566]  8801c49d8000 a0bb2e90 060b 
8801c9ad5ce8
| [ 8518.918568] Call Trace:
| [ 8518.918573]  [] dump_stack+0x45/0x56
| [ 8518.918576]  [] warn_slowpath_common+0x7d/0xa0
| [ 8518.918578]  [] warn_slowpath_fmt+0x4c/0x50
| [ 8518.918583]  [] __btrfs_abort_transaction+0x50/0x110 
[btrfs]
| [ 8518.918591]  [] cleanup_transaction+0x6e/0x290 [btrfs]
| [ 8518.918594]  [] ? prepare_to_wait_event+0x100/0x100
| [ 8518.918601]  [] btrfs_commit_transaction+0x6ea/0x970 
[btrfs]
| [ 8518.918608]  [] btrfs_commit_super+0x8f/0xa0 [btrfs]
| [ 8518.918614]  [] close_ctree+0x1e0/0x290 [btrfs]
| [ 8518.918617]  [] ? evict_inodes+0x11c/0x130
| [ 8518.918622]  [] btrfs_put_super+0x19/0x20 [btrfs]
| [ 8518.918625]  [] generic_shutdown_super+0x72/0xf0
| [ 8518.918627]  [] kill_anon_super+0x12/0x20
| [ 8518.918631]  [] btrfs_kill_super+0x16/0x90 [btrfs]
| [ 8518.918634]  [] deactivate_locked_super+0x3d/0x60
| [ 8518.918636]  [] deactivate_super+0x46/0x60
| [ 8518.918638]  [] mntput_no_expire+0xd6/0x170
| [ 8518.918640]  [] SyS_umount+0x8e/0x100
| [ 8518.918642]  [] tracesys+0xe1/0xe6
| [ 8518.918644] ---[ end trace 1a6b295c1d8ad4c3 ]---
| Nick  
`
kernel is tainted with a proprietary-out-of-tree module. try without the
radeon card...

kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: U64 Ordering in File System Code of Btrfs

2014-08-27 Thread anupam kapoor
> [Thu, 28 Aug 2014 00:54:47 -0400]: "nick" (nick):
,[ nick ]
| Hey Guys,
| Thanks for the help so far. I am wondering after reading the btrfs
| code for certain functions there seem to
| be a lot of u64 variable and function returns of this type. Is this
| common in file system due to the disk
| being in a certain format and depending on the CPU being big or small
| endian that this needed to not reorder
| the disk parts that are being read into main memory and preserve the data's 
ordering?
| Cheers Nick 
`
on disk format is little-endian.

have a look at https://btrfs.wiki.kernel.org/index.php/Main_Page for
more information. 

kind regards
anupam


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: I remove the audit and selinux from kernel and start the new kernel in Centos, but i can't bring up the network device, Why?

2014-10-12 Thread Anupam Kapoor
imho, not a pertinent topic for this list

kind regards
anupam

On Mon, Oct 13, 2014 at 10:34 AM, sizel  wrote:

>
>
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>


-- 
In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Socket receive, send

2014-10-13 Thread Anupam Kapoor
the best resource that _i_ know of (and probably you know it too) is
http://www.linuxfoundation.org/collaborate/workgroups/networking/mainpage,
see if that helps

kind regards
anupam

On Tue, Oct 14, 2014 at 7:42 AM, Grzegorz Dwornicki 
wrote:

> Hey
>
> Is there a good documentation on how messages are taking the tour from
> User calling read/write on socket fd,  to kernel handling the actual
> send/receive functions? I wish to write code to capture the messages (no
> netfilter - I wish to bypass it) for processing.
>
> I know there is a socket->ops structure with functions pointers. I am at
> the point to look the inet version on that pointers. But if there is a
> documentation on this it will save me some time.
>
> Grzegorz.
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>


-- 
In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: VLAN tagged packets received by application are corrupted

2014-11-20 Thread Anupam Kapoor
most likely you offload enabled on your card, try disabling that to see if
tcpdump does the right thing for you


kind regards
anupam

On Fri, Nov 21, 2014 at 10:19 AM, Amit Agarwal 
wrote:

> Hi all,
>
> I have query on vlan tagged packets received by network interface.
>
> Problem: I have application which would receive all packets on the
> interface
> and process them ( this could be including vlan tagged packets). However
> when
> the 8021q (vlan) module is not loaded and the appropriate interfaces for
> all
> the IDs are not created I see that the application is not able to decode
> them.
> When we capture with tcpdump/tshark/wireshark as well we see that the
> packets
> are not correctly displayed. The Ethernet header type itself is not
> correctly
> identified and thus the rest of the packet cannot be decoded. What could be
> causing this and is there a way to fix this?
>
> --
>  Thanks,
> -aka
>
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: unlikely compiler flag propagation

2015-02-19 Thread Anupam Kapoor

> [2015-02-19T00:08:01+0530]: "Nicholas Mc Guire" (nicholas-mcguire):
 nicholas-mcguire> On Wed, 18 Feb 2015, Greg KH wrote:
,[ greg-kh ]
| As proof of this, there was a test of the kernel a year or so ago that
| measured the placement of the existing likely/unlikely markers in the
| kernel and 90% of the usages were wrong and actually slowed down the
| processor.
`

,[ nicholas-mcguire ]
| interesting - would you have a reference to some talk/paper/data/... ?
`

couple of 'slightly' oldish posts:
   http://blog.man7.org/2012/10/how-much-do-builtinexpect-likely-and.html 
and
   http://thread.gmane.org/gmane.linux.kernel/1072767

---
thanks
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: What happens when an interrupt comes while in middle of printk?

2015-02-24 Thread anupam kapoor

> [2015-02-25T08:37:59+0530]: "manty kuma" (manty-kuma):
,[ manty-kuma ]
| What happens if an interrupt comes while in middle of printk execution and
| the interrupt handler has a printk in it?
| 
| There is a chance that the log_buf could be corrupted. isn't it?
`
no this doesn't happen. look at vprintk_emit(...) which invokes
local_irq_save(...).

essentially, printk tries to acquire console_lock. if it succeeds all is
well. otherwise, output is dumped to a log buffer. when the current
holder of console_lock, unlocks it, log buffer is emptied...

---
thanks
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Difference between System.map and /proc/kallsyms

2015-03-09 Thread Anupam Kapoor

> [2015-03-09T11:30:00+0530]: "Jamal" (Jamal):
,[ Jamal ]
| Hi..
| 
| After reading Documentation on System.map, i understood that , whenever 
| an oops happens the following addresses  will be converted to its 
| function name by klogd daemon using System.map.
| 
| Now when we have /proc/kallsyms which stores the symbol table in the 
| kernel image itself.Then what is the need of System.map file??Is any 
| process or daemon still using it??
`
oldish, but quite useful: http://www.dirac.org/linux/system.map/

---
thanks
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Learning things

2015-04-06 Thread Anupam Kapoor

> [2015-04-07T00:08:10+0530]: "Mike Thompson" (mike-thompson):
,[ mike-thompson ]
| As others mention, using the Linux kernel to come up to speed with C is the
| wrong approach.  If you have a strong desire to learn kernel programming
| concepts while coming up to speed on C, I would suggest getting the latest
| book on Xinu, buying an Intel Galileo board and working your way through
| that book.  Xinu is what I cut my teeth on 25 years ago and I remember it
| being a terrific learning environment.  Xinu is not Linux (or Unix), but
| for starting at the ground level all the concepts will map over when you
| are ready to tackle Linux kernel work.
| 
| Information for Xinu can be found here: http://www.xinu.cs.purdue.edu/
`
or there is always xv6 (http://pdos.csail.mit.edu/6.828/2014/) which
might be useful...

-- 
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: xtime variable in kernel 4.0

2015-04-14 Thread Anupam Kapoor

> [2015-04-14T18:17:08+0530]: "Mohammad A Khasawneh" (mohammad-Khasawneh):
,[ mohammad-Khasawneh ]
| I'm trying to develop a syscall in kernel v4.0 which copies the xtime
| variable to user space. I can find the variable in 3.X but it seems to have
| been changed in 4.0. Can anyone point me to its location?
`
commit 1e75fa8be9f condenses timekeeper.xtime into xtime_sec

-- 
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Knowledge of Protocols

2015-07-09 Thread Anupam Kapoor

> [2015-07-09T23:26:15+0530]: "Mohit ." (Mohit):
,[ Mohit ]
| I have just finished C & linux application programming with a tinge of socket 
programming.
| I would like to know what do statements like the following mean
|
| - "Have knowledge of Protocols such as TCP/IP, IPSec, IPV6 or SSL"   
| 
| 
| Does it mean to have a theoretical view of the facets which constitute the 
protocol which can be done by reading RFC or does it also mean to have 
implementation knowledge (code understanding) as well. I am not very clear 
about this statement which is generally used quite often.
| Secondly, it the latter understanding is correct (Theory - RFC + 
Implementation - Code) then where to look for the code which deals with a 
particular protocol ?
`
rfc's etc come in play once you start digging into internals of said
protocols. humble suggestion would be to start in a top->down
manner. first as a user of these, and then go 'down the stack' (so to
speak) if it strikes your fancy. 

if you don't know it already, richard-steven's networking books would
serve as an indispensable guide on your journey.

have fun !

-- 
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to get user level stack trace of an application from system crash

2015-10-07 Thread Anupam Kapoor

> [2015-10-07T14:55:07+0530]: "Shailendra Rana" (shailendra.rana1982):
,[ shailendra.rana1982 ]
| The application traps file events and send them over to other system
| via TCP. This other machine is running a third party solution which
| process these events and sends the verdict to the application which
| passes on the same to fanotify based on which decision of access to a
| file is made. I have seen this freeze issue in case of network
| failures but those are identifiable. There are couple of cases
| mentioned below which may lead to this.
| 
| 1) The event is received by third party solution but it did not send
| the verdict to the application. In that scenario need to notify this
| third party for fixing the issue.
| 2) Verdict is received by an application but could not pass on the
| same to fantiofy maybe it is stuck in an infinite loop. In this case I
| need to work towards fixing my application.
| 
| In order to identify the correct root cause I would want to have a
| user level stack trace of this application. Using crash tool I could
| not figure out the same.
| 
| I am using 3.13.0-24-generic #47-Ubuntu.
`
one word: libunwind

also, this is not a kernel topic, afaik
-- 
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to disable "module verification failed: signature and/or required key missing - tainting kernel" message?

2015-11-01 Thread Anupam Kapoor

> [2015-11-02T11:27:10+0530]: "Nan Xiao" (nan-xiao):
,[ nan-xiao ]
| When the vendor Linux system enable "kernel module signature
| verification" mechanism,
| if install your own built module, the kernel will complain:
| 
| module verification failed: signature and/or required key missing
| - tainting kernel
`
disable 'CONFIG_MODULE_SIG' in your kernel. more info available in
Documentation/module-signing.txt 

-- 
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to disable "module verification failed: signature and/or required key missing - tainting kernel" message?

2015-11-02 Thread Anupam Kapoor

> [2015-11-02T12:59:30+0530]: "Nan Xiao" (nan-xiao):
,[ nan-xiao ]
| I don't disable CONFIG_MODULE_SIG configuration in kernel. Since from this
| post 
(http://stackoverflow.com/questions/24975377/kvm-module-verification-failed-signature-and-or-required-key-missing-taintin),
| the answer said only disable this option in module's Makefile is enough.
`
following config options are available (under 'enable loadable module support')

CONFIG_MODULE_SIG : checks modules for valid signature on load.

CONFIG_MODULE_SIG_FORCE : rejects unsigned modules or modules for which
key is not available. 

thus, if, this is set to 'n' then loading a module with bad signature,
would taint the kernel. however, if, this is set to 'y' then loading a
module with bad signature will be rejected.

so, my guess is that in your case, this is most likely set to 'y'.

-- 
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to disable "module verification failed: signature and/or required key missing - tainting kernel" message?

2015-11-02 Thread Anupam Kapoor

> [2015-11-02T14:36:52+0530]: "Nan Xiao" (nan-xiao):

,[ nan-xiao ]
| Sorry, I am a little confused about your explanation.
`
ah sorry about that. i just re-read your original post, and realized
that you _are_ able to load the unsigned/badly-signed module. the only
point of concern is that you see a "taint" message. this is expected. 

from Documentation/module-signing.txt

,
|  (1) "Require modules to be validly signed" (CONFIG_MODULE_SIG_FORCE)
| 
|  This specifies how the kernel should deal with a module that has a
|  signature for which the key is not known or a module that is unsigned.
| 
|  If this is off (ie. "permissive"), then modules for which the key is not
|  available and modules that are unsigned are permitted, but the kernel 
will
|  be marked as being tainted, and the concerned modules will be marked as
|  tainted, shown with the character 'E'.
| 
|  If this is on (ie. "restrictive"), only modules that have a valid
|  signature that can be verified by a public key in the kernel's possession
|  will be loaded.  All other modules will generate an error.
| 
|  Irrespective of the setting here, if the module has a signature block 
that
|  cannot be parsed, it will be rejected out of hand.
`

if you don't want module signing at all, then set CONFIG_MODULE_SIG to
'n' and recompile your kernel. boot it, and then load modules without
signing 

--
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: looking for decent, current online discussion of user-space drivers

2015-11-17 Thread Anupam Kapoor

> [2015-11-17T15:43:52+0530]: "Robert P. J. Day" (rpjday):
,[ rpjday ]
| 
| in particular, are there any nice examples of this that
| can be downloaded, built and played with? thanks muchly.
`
there is snabbswitch (https://github.com/SnabbCo/snabbswitch) where
folks have written 82599 (intel-10g card) driver in lua
(https://github.com/SnabbCo/snabbswitch/tree/master/src/apps/intel)

might be useful...

--
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: viability of supporting interrupts in user space driver?

2015-11-20 Thread Anupam Kapoor

> [2015-11-20T13:08:46+0530]: "Robert P. J. Day" (robert-pj-day):
,[ robert-pj-day ]
| some colleagues are considering implementing some user space drivers
| that need to recognize and process interrupts. i'm aware of the
| possibilities -- UIO, for example -- but other than the technical
| possibility of doing that, can anyone provide feedback on the
| viability or benchmarking of that?
|
| is there an example someone can point at that demonstrates the
| goodness or not of such an approach? has anyone out there done this,
| and lived to regret it in terms of performance? thanks.
`
well, dpdk folks seem to be doing just that for quite a while, and seem
to be doing not too shabby in that space.

--
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: how to use wait_event_interruptible_timeout with less than 1 jiffie timeout?

2016-01-19 Thread Anupam Kapoor

> [2016-01-20T01:21:18+0530]: "Daniel." (Daniel):
,[ Daniel ]
| I have some code that convert an timeout comming from userspace (in
| ms) to jiffies prior passing to wait_event_interrupitible_timeout().
| The code looks like this:
| 
| unsigned long tout = user.timeout * HZ / 1000; /* convert from ms to jiffie */
| int status = wait_event_interruptible_timeout(wq, cond, tout);
| 
| I'm using HZ=100, the known default.
| The problem is: with HZ = 100 and user.timeout = 10 I have:
| 10 * 100 / 1000 = 1,
| 
| This means that I can't use timeouts with less than 10ms. Is there any
| way to circunvent this without changing HZ value?
`
wouldn't msleep_interruptible(...) be a better choice ? as a bonus, it
takes care of jiffies wrapping etc. 

-- 
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: how to use wait_event_interruptible_timeout with less than 1 jiffie timeout?

2016-01-20 Thread Anupam Kapoor

> [2016-01-20T13:55:54+0530]: "Nicholas Mc Guire" (Nicholas):
,[ Nicholas ]
| that would still have the same limitation with resepct to time granuarlity
| and as Documentation/timers/
`
ah yes, that's true.

,[ Nicholas ]
| if you really need very short delays then you will need to resort to hrtimers
| (and thus be to some extent config dependent) usleep_range(min, max) is the 
| prefered interface in that case.
`
any specific reason why schedule_hrtimeout(...) cannot be used ?

-- 
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Capture packets at 10g interface

2016-01-29 Thread Anupam Kapoor
On Saturday 30 January 2016, Daniel Ng  wrote:

>
> >> On Fri, Jan 29, 2016 at 07:37:57PM +0530, Tarun Batra wrote:
> >> We are trying to build product and as per decisions of senior we need to
> >> capture packets in kernel
> >
> My understanding is 10G interfaces push traffic directly into userspace-
> the kernel is not involved at all here.

depends, if you are doing kernel bypass then yes e.g dpdk and friends,
otherwise probably not.

---
thanks
anupam


-- 
In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Backtrace of every the threads

2016-02-10 Thread Anupam Kapoor

> [2016-02-10T14:35:33+0530]: "Ricardo Ribalda Delgado" (ricardo-delgado):

,[ ricardo-delgado ]
| Luckily, the error is gone now :). but I was wondering if there is a
| way to show the backtrace of ALL the threads in the system, which
| could have been a wonderful tool to debug this issue.
`
from the gdb info page:

In a multi-threaded program, gdb by default shows the backtrace only for
the current thread. To display the backtrace for several or all of the
threads, use the command thread apply (see thread apply). For example,
if you type thread apply all backtrace, gdb will display the backtrace
for all the threads; this is handy when you debug a core dump of a
multi-threaded program.

hope that's what you are looking for ?

--

kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Backtrace of every the threads

2016-02-10 Thread Anupam Kapoor

> [2016-02-10T15:06:30+0530]: "Ricardo Ribalda Delgado" (ricardo-delgado):
,[ ricardo-delgado ]
| Unfortunately not :( But thanks for trying :)
`
seems to work just fine on a trivial program here:
< aside: hopefully, i will not be judged too harshly for c++ :) >

,
| anupam@fatcat cpu-stuff % gdb obj/affine-thread-to-cpu
| GNU gdb (GDB) 7.10.1
| Copyright (C) 2015 Free Software Foundation, Inc.
| License GPLv3+: GNU GPL version 3 or later 
| This is free software: you are free to change and redistribute it.
| There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
| and "show warranty" for details.
| This GDB was configured as "x86_64-unknown-linux-gnu".
| Type "show configuration" for configuration details.
| For bug reporting instructions, please see:
| .
| Find the GDB manual and other documentation resources online at:
| .
| For help, type "help".
| Type "apropos word" to search for commands related to "word"...
| Reading symbols from obj/affine-thread-to-cpu...done.
| (gdb) core core.11717
| warning: core file may not match specified executable file.
| [New LWP 11717]
| [New LWP 11718]
| [New LWP 11720]
| [New LWP 11721]
| [New LWP 11719]
| warning: Could not load shared library symbols for linux-vdso.so.1.
| Do you need "set solib-search-path" or "set sysroot"?
| [Thread debugging using libthread_db enabled]
| Using host libthread_db library "/usr/lib/libthread_db.so.1".
| Core was generated by `./obj/affine-thread-to-cpu'.
| Program terminated with signal SIGSEGV, Segmentation fault.
| #0  0x7f4a34f9170d in pthread_join () from /usr/lib/libpthread.so.0
| [Current thread is 1 (Thread 0x7f4a3536f740 (LWP 11717))]
| (gdb) thread apply all
| Please specify a command following the thread ID list
| (gdb) thread apply all bt
|
| Thread 5 (Thread 0x7f4a33b4d700 (LWP 11719)):
| #0  0x7f4a34f9965d in nanosleep () from /usr/lib/libpthread.so.0
| #1  0x00401534 in std::this_thread::sleep_for > (__rtime=...) at /usr/include/c++/5.3.0/thread:292
| #2  ::operator() (__closure=0x24d8de8) at 
affine-thread-to-cpu.cpp:27
| #3  std::_Bind_simple()>::_M_invoke<> 
(this=0x24d8de8) at /usr/include/c++/5.3.0/functional:1531
| #4  std::_Bind_simple()>::operator() 
(this=0x24d8de8) at /usr/include/c++/5.3.0/functional:1520
| #5  std::thread::_Impl()> 
>::_M_run(void) (this=0x24d8dd0) at /usr/include/c++/5.3.0/thread:115
| #6  0x7f4a34cbff40 in std::(anonymous 
namespace)::execute_native_thread_routine (__p=)
| at /build/gcc/src/gcc-5.3.0/libstdc++-v3/src/c++11/thread.cc:84
| #7  0x7f4a34f904a4 in start_thread () from /usr/lib/libpthread.so.0
| #8  0x7f4a3443813d in clone () from /usr/lib/libc.so.6
|
| Thread 4 (Thread 0x7f4a32b4b700 (LWP 11721)):
| #0  0x7f4a34f9965d in nanosleep () from /usr/lib/libpthread.so.0
| #1  0x00401534 in std::this_thread::sleep_for > (__rtime=...) at /usr/include/c++/5.3.0/thread:292
| #2  ::operator() (__closure=0x24d90c8) at 
affine-thread-to-cpu.cpp:27
| #3  std::_Bind_simple()>::_M_invoke<> 
(this=0x24d90c8) at /usr/include/c++/5.3.0/functional:1531
| #4  std::_Bind_simple()>::operator() 
(this=0x24d90c8) at /usr/include/c++/5.3.0/functional:1520
| #5  std::thread::_Impl()> 
>::_M_run(void) (this=0x24d90b0) at /usr/include/c++/5.3.0/thread:115
| #6  0x7f4a34cbff40 in std::(anonymous 
namespace)::execute_native_thread_routine (__p=)
| at /build/gcc/src/gcc-5.3.0/libstdc++-v3/src/c++11/thread.cc:84
| #7  0x7f4a34f904a4 in start_thread () from /usr/lib/libpthread.so.0
| #8  0x7f4a3443813d in clone () from /usr/lib/libc.so.6
|
| Thread 3 (Thread 0x7f4a3334c700 (LWP 11720)):
| #0  0x7f4a34f9965d in nanosleep () from /usr/lib/libpthread.so.0
| #1  0x00401534 in std::this_thread::sleep_for > (__rtime=...) at /usr/include/c++/5.3.0/thread:292
| #2  ::operator() (__closure=0x24d8f58) at 
affine-thread-to-cpu.cpp:27
| #3  std::_Bind_simple()>::_M_invoke<> 
(this=0x24d8f58) at /usr/include/c++/5.3.0/functional:1531
| #4  std::_Bind_simple()>::operator() 
(this=0x24d8f58) at /usr/include/c++/5.3.0/functional:1520
| #5  std::thread::_Impl()> 
>::_M_run(void) (this=0x24d8f40) at /usr/include/c++/5.3.0/thread:115
| #6  0x7f4a34cbff40 in std::(anonymous 
namespace)::execute_native_thread_routine (__p=)
| at /build/gcc/src/gcc-5.3.0/libstdc++-v3/src/c++11/thread.cc:84
| #7  0x7f4a34f904a4 in start_thread () from /usr/lib/libpthread.so.0
| #8  0x7f4a3443813d in clone () from /usr/lib/libc.so.6
|
| Thread 2 (Thread 0x7f4a3434e700 (LWP 11718)):
| #0  0x7f4a34f9965d in nanosleep () from /usr/lib/libpthread.so.0
| #1  0x00401534 in std::this_thread::sleep_for > (__rtime=...) at /usr/include/c++/5.3.0/thread:292
| #2  ::operator() (__closure=0x24d8c78) at 
affine-thread-to-cpu.cpp:27
| #3  std::_Bind_simple()>::_M_invoke<> 
(this=0x24d8c78) at /usr/include/c++/5.

Re: Backtrace of every the threads

2016-02-10 Thread Anupam Kapoor

> [2016-02-10T16:26:40+0530]: "Ricardo Ribalda Delgado" (ricardo-delgado):
,[ ricardo-delgado ]
| By thread I mean kernel thread, and user thread.
|
| What i want to get is a back trace of ALL the programs running in user
| and kernel space.
`
d.u.d.e :)


--
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Microsoft wireless usb mouse frequently fails to detect in ubuntu 15.10/16.04

2016-04-20 Thread Anupam Kapoor


> [2016-04-21T10:23:01+0530]: "rootsr" (rootsr):
,[ rootsr ]
| [   74.186391] usb 1-1.3: new full-speed USB device number 7 using ehci-pci
| [   74.258396] usb 1-1.3: device descriptor read/64, error -32
`
see if this helps : 
http://askubuntu.com/questions/117524/usb-device-not-accepting-address

--
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: unable to find function definition

2016-04-27 Thread Anupam Kapoor

> [2016-04-28T01:56:26+0530]: "Jakub Sitnicki" (jakub-sitnicki):
,[ jakub-sitnicki ]
| An alternative would be to use cscope:
|
| $ # build the index (will take a moment)
| $ make cscope
`
this ! cscope generally just works for way better than other 'manual'
mechanisms. since it builds inverse database as well (the -q option),
symbol lookups are pretty fast.

xcscope provides a seamless experience within emacs...

--
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: IEEE-754 Float to int

2016-11-22 Thread Anupam Kapoor
On Tue, Nov 22, 2016 at 9:35 PM, Lucas Tanure  wrote:

> So, value has a 32bit float now, and I would like to print just the
> integer part, like :
> Read 26.92387 --> Print 26.
>

​how about just typecasting to int ? so :

int x = (int)(some-float-value)

that should be it right ?​


​--
kind regards
anupam​


In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: IEEE-754 Float to int

2016-11-22 Thread Anupam Kapoor
On Tue, Nov 22, 2016 at 9:51 PM, Lucas Tanure  wrote:

> But this "some-float-value" must be declared as float ? Can I do that ?
>

​in your example, isn't 'value' a float type​ already ?

​--
kind regards
anupam​


In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: IEEE-754 Float to int

2016-11-23 Thread Anupam Kapoor
On Wed, Nov 23, 2016 at 6:00 PM, Lucas Tanure  wrote:

> The best way to do it seems to be to write conversion function.
> Receive the float in a u32, parse it's bits and return a s32. Can be
> done without the use of floats.
>

​but this conversion-function might not be straight-forward :) ​it _may_ be
possibly simplified depending on your precision requirements etc. etc.

​--
kind regards
anupam​


In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Question about arp caches

2016-11-28 Thread Anupam Kapoor
On Tue, Nov 29, 2016 at 10:40 AM, Shawn Peng  wrote:

> I'm reading the code about arp protocol. It seems like the kernel uses
> the neigh_table structure to keep track of caches, right?
>
​yes.​



> There should
> be some code that remove the stale entries in the cache, but I didn't
> find the code that does this job. Does anyone have an idea?
>
​look at neigh_release(...) and neigh_destroy(...). basically,
neigh_release(...) decrements the reference count of a neighbor, and
neigh_destroy(...) frees it when this reference count reaches zero.​



​--
kind regards
anupam​


In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Fwd: Question about arp caches

2016-11-29 Thread Anupam Kapoor
FYI

-- Forwarded message -
From: Anupam Kapoor 
Date: Tue, 29 Nov 2016 at 1:25 PM
Subject: Re: Question about arp caches
To: Shawn Peng 


​On Tue, Nov 29, 2016 at 12:49 PM, Shawn Peng  wrote:

I find a lot references of the function neigh_release(), can you direct me
to the one that releases a staled arp entry?


​neigh_destroy(...) is probably what you are looking for.

--
kind regards
anupam​



-- 
In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Fwd: Question about arp caches

2016-11-30 Thread Anupam Kapoor
On Wed, Nov 30, 2016 at 1:46 PM, Yisu Peng  wrote:

> So, how is the kernel check those staled arp entries? Or, what is the
> mechanism that the kernel uses to find the out of date entries?


​ok sure, well, each neighbor entry (struct neighbour) has a 'timer' (which
is created during neighbor creation i.e. during neigh_alloc(...)). this
timer gets 'serviced' by '​neigh_timer_handler(...)', which is the per
neighbor garbage collector handler.

when the state of the neighbor becomes NUD_FAILED, the neighbor is
collected via invokation of 'neigh_release(...)' as indicated earlier.

​--
kind regards
anupam​

In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: transfer physical memory page to swap disk

2020-01-15 Thread Anupam Kapoor
On Wed, 15 Jan 2020 at 6:02 PM Sumit Kumar  wrote:

> Hi,
> Does C/C++ provide any API / system call that enables user to force the
> application to transfer some its physical pages to swap disk ? If so, is it
> also possible to obtain the least used page using some API ?
>

would madvise not serve your needs ?

—
kind regards
anupam
-- 
In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: transfer physical memory page to swap disk

2020-01-19 Thread Anupam Kapoor
On Wed, 15 Jan 2020 18:23:05 +0530, Anupam Kapoor said:
>> On Wed, 15 Jan 2020 at 6:02 PM Sumit Kumar  wrote:
>>> Does C/C++ provide any API / system call that enables user to force the
>>> application to transfer some its physical pages to swap disk ? If so,
is it
>>> also possible to obtain the least used page using some API ?

>> would madvise not serve your needs ?

> There's this word "force" in the question.

> The problem is that madvise() is *advice* to the kernel, not a strict
> guarantee.  There's a difference between "If you need to move pages
> to disk, consider these pages first" and "Move them to disk now, whether
> you really wanted to or not".

ofcourse (afaik) there is no way for the application to force the
*kernel* to do something like this.

but if _all_ that is required is randomly unmapping some marked
application pages, _that_ can be naively 'done' by the application
itself :)

for example, have a list of unmappable pages and an unmapper thread
which does the unmapping for you (picking any element in the list
at random)

--
kind regards
anupam

In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.


On Sat, Jan 18, 2020 at 3:10 PM Valdis Klētnieks 
wrote:

> On Wed, 15 Jan 2020 18:23:05 +0530, Anupam Kapoor said:
> > On Wed, 15 Jan 2020 at 6:02 PM Sumit Kumar 
> wrote:
> > > Does C/C++ provide any API / system call that enables user to force the
> > > application to transfer some its physical pages to swap disk ? If so,
> is it
> > > also possible to obtain the least used page using some API ?
> > would madvise not serve your needs ?
>
> There's this word "force" in the question.
>
> The problem is that madvise() is *advice* to the kernel, not a strict
> guarantee.  There's a difference between "If you need to move pages
> to disk, consider these pages first" and "Move them to disk now, whether
> you really wanted to or not".
>
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: transfer physical memory page to swap disk

2020-01-19 Thread Anupam Kapoor
>> but if _all_ that is required is randomly unmapping some marked
>> application pages, _that_ can be naively 'done' by the application
>> itself :)

> Note that in this case, "naively" includes "not remembering to consider
> that the page being unmapped may have contained data we'd rather
> have kept by flushing the page to disk" :)

but is it that bad ?

before marking a page unmappable, the application has full control
over what it wants to do with the data, and can choose to dump it
to the appropriate destination.

or if enough information is available, the unmapper thread can itself
play that role.

thinking some more about it, application has full control over the
unmap/resurrect behavior. though latter might not be as
transparent...

--
kind regards
anupam

In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.


On Sun, Jan 19, 2020 at 11:14 AM Valdis Klētnieks 
wrote:

> On Sun, 19 Jan 2020 10:55:44 +, Anupam Kapoor said:
>
> > but if _all_ that is required is randomly unmapping some marked
> > application pages, _that_ can be naively 'done' by the application
> > itself :)
>
> Note that in this case, "naively" includes "not remembering to consider
> that the page being unmapped may have contained data we'd rather
> have kept by flushing the page to disk" :)
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: transfer physical memory page to swap disk

2020-01-19 Thread Anupam Kapoor
On Sun, 19 Jan 2020 at 6:48 PM Valdis Klētnieks 
wrote:

> On Sun, 19 Jan 2020 12:45:57 +0000, Anupam Kapoor said:
>
> > > Note that in this case, "naively" includes "not remembering to consider
> > > that the page being unmapped may have contained data we'd rather
> > > have kept by flushing the page to disk" :)
> >
> > but is it that bad ?
> >
> > before marking a page unmappable, the application has full control
> > over what it wants to do with the data, and can choose to dump it
> > to the appropriate destination.
>
> Yes, but now you're getting into more code that has to be written,
> including
> code to marshal things like binary trees into a savable format, and more
> code
> to read them back at a later time. Plus all the fun if the tree has
> hundreds of thousands
> or millions of entries, and how to deal with it if some parts of the tree
> have been
> released and saved to disk, or if the 4K page contained members of several
> different
> data structures - in other words, you probably just decided to write your
> own backing store,
> garbage collector, and virtual object manager for your heap.
>
> As I said - it's a naive approach that ends up following the 90/10 rule:
> the easy 90% of it takes the first 90% of the time to code it, and the
> difficult
> 10% takes the other 90% of the time... :)


well sure, if you try to replicate everything that exists below libc, then
there is little hope.

however if your application’s data can be serialized/deserialized, then i
_suspect_ it might not be too much of work.

for example, if i am maintaining l2 forwarding table entries then it might
be possible to have, on an average fixed number of pages representing this
cache...

—
kind regards
anupam

>
> --
In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies